INNER CODE UNIT · TypeScript

take

paulmillr/noble-ciphers · src/_arx.ts:410

      const take = Math.min(len, this.blockLen - this.pos);
      out.set(this.buf.subarray(this.pos, this.pos + take), 0);
      this.pos += take;
      outPos += take;
      if (outPos === len) return out as TRet<Uint8Array>; // fast path
    }
    // Full blocks directly to out
    const full = Math.floor((len - outPos) / this.blockLen);
    if (full > 0) {
      const blockBytes = full * this.blockLen;
      const b = out.subarray(outPos, outPos + blockBytes);
      this.cipher(this.key, this.nonce, b as TRet<Uint8Array>, b as TRet<Uint8Array>, this.ctr);
      this.ctr += full;
      outPos += blockBytes;
    }
    // Save leftovers
    const left = len - outPos;
    if (left > 0) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…