Debian Codegraph @

crypto/salsa/README

raw
1 salsa: Salsa20/XSalsa20 stream ciphers
2
3 crypto::salsa provides an implementation of the Salsa20 and XSalsa20 stream
4 ciphers, per "Salsa20 specification" by Daniel J. Bernstein.
5
6 Use [[salsa20]] to create a stream and either [[xsalsa20_init]] or
7 [[salsa20_init]] to set handle, key and nonce of the appropriate size,
8 [[NONCESZ]] for salsa20 or [[XNONCESZ]] for XSalsa20. After calling the
9 appropriate init function, [[io::write]] may be used to encrypt blocks to the
10 handle or [[io::read]] to decrypt blocks from the handle. The stream must be
11 closed with [[io::close]] to wipe sensitive data from memory.
12
13 Writing blocks of length [[BLOCKSZ]] is not required. However, seeking the key
14 stream with [[setctr]] only operates in units of [[BLOCKSZ]].
15
16 This is a low-level module which implements cryptographic primitives. Direct use
17 of cryptographic primitives is not recommended for non-experts, as incorrect use
18 of these primitives can easily lead to the introduction of security
19 vulnerabilities. Non-experts are advised to use the high-level operations
20 available in the top-level [[crypto::]] module.
21
22 Be advised that Hare's cryptography implementations have not been audited.