INNER CODE UNIT · TypeScript
runCipher
paulmillr/noble-ciphers · src/_arx.ts:158
function runCipher(
core: TArg<CipherCoreFn>,
sigma: TArg<Uint32Array>,
key: TArg<Uint32Array>,
nonce: TArg<Uint32Array>,
data: TArg<Uint8Array>,
output: TArg<Uint8Array>,
counter: number,
rounds: number
): void {
const len = data.length;
const block = new Uint8Array(BLOCK_LEN);
const b32 = u32(block);
// Make sure that buffers aligned to 4 bytes
const isAligned = isLE && isAligned32(data) && isAligned32(output);
const d32 = isAligned ? u32(data) : U32_EMPTY;
const o32 = isAligned ? u32(output) : U32_EMPTY;
// RFC 8439 §2.4.1 / RFC 7539 §2.4.1 allow XORing one keystream block at a time and