1
0
Fork 0
mirror of https://github.com/lightning/bolts.git synced 2025-02-23 22:46:57 +01:00

BOLT 8: Nonces should be little-endian, 64 bit.

This follows the Noise spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-12-22 11:31:38 +10:30
parent 856331e347
commit fcc93d480a

View file

@ -138,13 +138,14 @@ The following functions will also be referenced:
* `encryptWithAD(k, n, ad, plaintext)`: outputs `encrypt(k, n, ad, plaintext)` * `encryptWithAD(k, n, ad, plaintext)`: outputs `encrypt(k, n, ad, plaintext)`
* where `encrypt` is an evaluation of `ChaCha20-Poly1305` (IETF variant) with the passed * where `encrypt` is an evaluation of `ChaCha20-Poly1305` (IETF variant) with the passed
arguments, with nonce `n` encoded as a big-endian 96-bit value. arguments, with nonce `n` encoded as 32 zero bits followed by a *little-endian* 64-bit value (this
follows the Noise Protocol convention, rather than our normal endian).
* `decryptWithAD(k, n, ad, ciphertext)`: outputs `decrypt(k, n, ad, ciphertext)` * `decryptWithAD(k, n, ad, ciphertext)`: outputs `decrypt(k, n, ad, ciphertext)`
* where `decrypt` is an evaluation of `ChaCha20-Poly1305` (IETF variant) with the passed * where `decrypt` is an evaluation of `ChaCha20-Poly1305` (IETF variant) with the passed
arguments, with nonce `n` encoded as a big-endian 96-bit value. arguments, with nonce `n` encoded as 32 zero bits followed by a *little-endian* 64-bit value.
* `generateKey()` * `generateKey()`
* where generateKey generates and returns a fresh `secp256k1` keypair * where generateKey generates and returns a fresh `secp256k1` keypair