Commit graph

10 commits

Author SHA1 Message Date
josibake
b946f8a4c5
crypto: add NUMS_H const 2024-05-14 10:24:31 +02:00
Sebastian Falbesoner
a8c3454ba1 test: speedup bip324_cipher.py unit test
Executing the unit tests for the bip324_cipher.py module currently
takes quite long (>60 seconds on my notebook). Most time here is spent
in empty plaintext/ciphertext encryption/decryption loops:

    ....
    for _ in range(msg_idx):
        enc_aead.encrypt(b"", b"")
    ...
    for _ in range(msg_idx):
        enc_aead.decrypt(b"", bytes(16))
    ...

Their sole purpose is increasing the FSChaCha20Poly1305 packet
counters in order to trigger rekeying, i.e. the actual
encryption/decryption is not relevant, as the result is thrown away.
This commit speeds up the tests by supporting to pass "None" as
plaintext/ciphertext, indicating to the routines that no actual
encryption/decryption should be done.

master branch:

$ python3 -m unittest ./test/functional/test_framework/crypto/bip324_cipher.py
..
----------------------------------------------------------------------
Ran 2 tests in 64.658s

PR branch:

$ python3 -m unittest ./test/functional/test_framework/crypto/bip324_cipher.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.822s
2024-02-06 01:35:03 +01:00
stratospher
c534c08710 [test/crypto] Add FSChaCha20Poly1305 AEAD python implementation
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-29 17:50:38 +05:30
stratospher
c2a458f1c2 [test/crypto] Add FSChaCha20 python implementation
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-29 17:50:38 +05:30
stratospher
c4ea5f6288 [test/crypto] Add RFC 8439's ChaCha20Poly1305 AEAD
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-29 17:50:38 +05:30
stratospher
9fc6e0355e [test/crypto] Add Poly1305 python implementation
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-29 17:50:38 +05:30
stratospher
fec2ca6c9a [test/crypto] Use chacha20_block function in data_to_num3072 2023-09-29 17:50:38 +05:30
stratospher
0cde60da3a [test/crypto] Add ChaCha20 python implementation
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-29 17:50:32 +05:30
stratospher
69d3f50ab6 [test/crypto] Add HMAC-based Key Derivation Function (HKDF)
Co-authored-by: Pieter Wuille <pieter.wuille@gmail.com>
2023-09-12 09:59:46 +05:30
stratospher
08a4a56cbc [test] Move test framework crypto functions to crypto/ 2023-09-10 23:16:39 +05:30