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