/
opt
/
canhelp
/
node_modules
/
@noble
/
ciphers
/
/opt/canhelp/node_modules/@noble/ciphers
mkdir
upload
Name
Size
Mode
Actions
src/
-
0755
rm
aes.d.ts
8307
0644
edit
dl
rm
aes.d.ts.map
4772
0644
edit
dl
rm
aes.js
50350
0644
edit
dl
rm
aes.js.map
54638
0644
edit
dl
rm
chacha.d.ts
3296
0644
edit
dl
rm
chacha.d.ts.map
943
0644
edit
dl
rm
chacha.js
14213
0644
edit
dl
rm
chacha.js.map
18406
0644
edit
dl
rm
ff1.d.ts
420
0644
edit
dl
rm
ff1.d.ts.map
452
0644
edit
dl
rm
ff1.js
6172
0644
edit
dl
rm
ff1.js.map
7851
0644
edit
dl
rm
index.d.ts
46
0644
edit
dl
rm
index.d.ts.map
101
0644
edit
dl
rm
index.js
1102
0644
edit
dl
rm
index.js.map
173
0644
edit
dl
rm
LICENSE
1161
0644
edit
dl
rm
package.json
2170
0644
edit
dl
rm
README.md
26826
0644
edit
dl
rm
salsa.d.ts
1327
0644
edit
dl
rm
salsa.d.ts.map
679
0644
edit
dl
rm
salsa.js
11271
0644
edit
dl
rm
salsa.js.map
13769
0644
edit
dl
rm
utils.d.ts
8116
0644
edit
dl
rm
utils.d.ts.map
5024
0644
edit
dl
rm
utils.js
13458
0644
edit
dl
rm
utils.js.map
11582
0644
edit
dl
rm
webcrypto.d.ts
1096
0644
edit
dl
rm
webcrypto.d.ts.map
935
0644
edit
dl
rm
webcrypto.js
3917
0644
edit
dl
rm
webcrypto.js.map
3333
0644
edit
dl
rm
_arx.d.ts
3417
0644
edit
dl
rm
_arx.d.ts.map
1653
0644
edit
dl
rm
_arx.js
9728
0644
edit
dl
rm
_arx.js.map
9097
0644
edit
dl
rm
_poly1305.d.ts
1947
0644
edit
dl
rm
_poly1305.d.ts.map
997
0644
edit
dl
rm
_poly1305.js
12035
0644
edit
dl
rm
_poly1305.js.map
17809
0644
edit
dl
rm
_polyval.d.ts
2035
0644
edit
dl
rm
_polyval.d.ts.map
1608
0644
edit
dl
rm
_polyval.js
7922
0644
edit
dl
rm
_polyval.js.map
10164
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/@noble/ciphers/_arx.d.ts
(3417B)
/** * Basic utils for ARX (add-rotate-xor) salsa and chacha ciphers. RFC8439 requires multi-step cipher stream, where authKey starts with counter: 0, actual msg with counter: 1. For this, we need a way to re-use nonce / counter: const counter = new Uint8Array(4); chacha(..., counter, ...); // counter is now 1 chacha(..., counter, ...); // counter is now 2 This is complicated: - 32-bit counters are enough, no need for 64-bit: max ArrayBuffer size in JS is 4GB - Original papers don't allow mutating counters - Counter overflow is undefined [^1] - Idea A: allow providing (nonce | counter) instead of just nonce, re-use it - Caveat: Cannot be re-used through all cases: - * chacha has (counter | nonce) - * xchacha has (nonce16 | counter | nonce16) - Idea B: separate nonce / counter and provide separate API for counter re-use - Caveat: there are different counter sizes depending on an algorithm. - salsa & chacha also differ in structures of key & sigma: salsa20: s[0] | k(4) | s[1] | nonce(2) | cnt(2) | s[2] | k(4) | s[3] chacha: s(4) | k(8) | cnt(1) | nonce(3) chacha20orig: s(4) | k(8) | cnt(2) | nonce(2) - Idea C: helper method such as `setSalsaState(key, nonce, sigma, data)` - Caveat: we can't re-use counter array xchacha [^2] uses the subkey and remaining 8 byte nonce with ChaCha20 as normal (prefixed by 4 NUL bytes, since [RFC8439] specifies a 12-byte nonce). [^1]: https://mailarchive.ietf.org/arch/msg/cfrg/gsOnTJzcbgG6OqD8Sc0GO5aR_tU/ [^2]: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha#appendix-A.2 * @module */ import { type PRG, type XorStream } from './utils.ts'; /** Rotate left. */ export declare function rotl(a: number, b: number): number; /** Ciphers must use u32 for efficiency. */ export type CipherCoreFn = (sigma: Uint32Array, key: Uint32Array, nonce: Uint32Array, output: Uint32Array, counter: number, rounds?: number) => void; /** Method which extends key + short nonce into larger nonce / diff key. */ export type ExtendNonceFn = (sigma: Uint32Array, key: Uint32Array, input: Uint32Array, output: Uint32Array) => void; /** ARX cipher options. * * `allowShortKeys` for 16-byte keys * * `counterLength` in bytes * * `counterRight`: right: `nonce|counter`; left: `counter|nonce` * */ export type CipherOpts = { allowShortKeys?: boolean; extendNonceFn?: ExtendNonceFn; counterLength?: number; counterRight?: boolean; rounds?: number; }; /** Creates ARX-like (ChaCha, Salsa) cipher stream from core function. */ export declare function createCipher(core: CipherCoreFn, opts: CipherOpts): XorStream; /** Internal class which wraps chacha20 or chacha8 to create CSPRNG. */ export declare class _XorStreamPRG implements PRG { readonly blockLen: number; readonly keyLen: number; readonly nonceLen: number; private state; private buf; private key; private nonce; private pos; private ctr; private cipher; constructor(cipher: XorStream, blockLen: number, keyLen: number, nonceLen: number, seed: Uint8Array); private reseed; addEntropy(seed: Uint8Array): void; randomBytes(len: number): Uint8Array; clone(): _XorStreamPRG; clean(): void; } export type XorPRG = (seed?: Uint8Array) => _XorStreamPRG; export declare const createPRG: (cipher: XorStream, blockLen: number, keyLen: number, nonceLen: number) => XorPRG; //# sourceMappingURL=_arx.d.ts.map
Save
cmd:
run