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

Function generate_cipher_stream

common/sphinx.c:236–241  ·  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

234 * store it in `dst`. `dst must be at least `dstlen` bytes long.
235 */
236static void generate_cipher_stream(void *dst, const struct secret *k, size_t dstlen)
237{
238 const u8 nonce[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
239
240 crypto_stream_chacha20(dst, dstlen, nonce, k->data);
241}
242
243/* xor cipher stream into dst */
244static 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