chacha20
chacha20(
seed?):ChaCha20
Defined in: src/engine/chacha20.ts:131
ChaCha20 — a cryptographic stream cipher used as a generator.
The only engine that is both seedable and unpredictable: knowing any
number of outputs does not reveal the rest. Use it when a stream must be
reproducible and resistant to prediction; for secrets with no
reproducibility requirement, ransu/secure is simpler.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Example
Section titled “Example”const source = chacha20(12345);source.nextUint32(); // 1274611588
// Reproducible, unlike the platform CSPRNG.chacha20(1).nextUint32() === chacha20(1).nextUint32(); // true