MCPcopy Create free account
hub / github.com/ElementsProject/lightning / generate_cipher_stream

Function generate_cipher_stream

common/sphinx.c:208–213  ·  view source on GitHub ↗

* Generate a pseudo-random byte stream of length `dstlen` from key `k` and * store it in `dst`. `dst must be at least `dstlen` bytes long. */

Source from the content-addressed store, hash-verified

206 * store it in `dst`. `dst must be at least `dstlen` bytes long.
207 */
208static void generate_cipher_stream(void *dst, const struct secret *k, size_t dstlen)
209{
210 const u8 nonce[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
211
212 crypto_stream_chacha20(dst, dstlen, nonce, k->data);
213}
214
215/* xor cipher stream into dst */
216static void xor_cipher_stream(void *dst, const struct secret *k, size_t dstlen)

Callers 1

create_onionpacketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected