bip-0324/reference.py
does), so use crypt() to be clear that we’re not using FSChaCha20Poly1305 for peer.send_L
.
bip-0324/reference.py
does), so use crypt() to be clear that we’re not using FSChaCha20Poly1305 for peer.send_L
.
The FSChaCha20 class, as written in the BIP's pseudocode, doesn't have
an encrypt() method (even though the equivalent class in the
`bip-0324/reference.py` does), so use crypt() to be clear that we're
not using FSChaCha20Poly1305 for `peer.send_L`.
For some reason, the fragments `b''` and `__init__` don't display
properly in Github's mediawiki format, so special-case those.
<source>
fragments containing __init__()
don’t render properly, probably due to a collision with mediawiki’s italics syntax.
485+def v2_enc_packet(peer, contents, aad=b"", ignore=False):
486 assert len(contents) <= 2**24 - 1
487 header = (ignore << IGNORE_BIT_POS).to_bytes(HEADER_LEN, 'little')
488 plaintext = header + contents
489 aead_ciphertext = peer.send_P.encrypt(aad, plaintext)
490- enc_contents_len = peer.send_L.encrypt(len(contents).to_bytes(LENGTH_FIELD_LEN, 'little'))
encrypt
and decrypt
methods to the class.
495
496-<pre>
497+<source lang="python">
498 CHACHA20POLY1305_EXPANSION = 16
499
500-def v2_receive_packet(peer, aad=b'', skip_decoy=True):
'
and "
in the source, which is also not very consistent.
Thanks! It seems people actually read this. :)
Sad that GitHub rendering is that broken…