Debian Codegraph @

crypto/chacha/README

raw
1 chacha: Chacha20 and XChacha20 stream cipher support
2
3 crypto::chacha provides an implementation of the Chacha20 and XChacha20 stream
4 ciphers.
5
6 Use [[chacha20]] to create a [[crypto::cipher::xorstream]] and either
7 [[chacha20_init]] or [[xchacha20_init]] to set the handle, key and nonce of the
8 appropriate size, [[NONCESZ]] for chacha20 or [[XNONCESZ]] for XChacha20. After
9 calling the appropriate init function, [[io::write]] may be used to encrypt
10 blocks to the handle or [[io::read]] to decrypt blocks from the handle. The
11 stream must be 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
17 use of cryptographic primitives is not recommended for non-experts, as
18 incorrect use of these primitives can easily lead to the introduction of
19 security vulnerabilities. Non-experts are advised to use the high-level
20 operations available in the top-level [[crypto::]] module.
21
22 Be advised that Hare's cryptography implementations have not been audited.