diff options
author | josibake <josibake@protonmail.com> | 2024-02-13 17:41:59 +0100 |
---|---|---|
committer | josibake <josibake@protonmail.com> | 2024-05-14 10:24:31 +0200 |
commit | b946f8a4c51be42e52d63a6d578158c0b2a6b7ed (patch) | |
tree | be4593a291f6ff4bc0a0f99f340dcb50f38951d3 /test | |
parent | 2cedb42a928fbf3a1e0e8715e918497cbe64af0d (diff) | |
download | bitcoin-b946f8a4c51be42e52d63a6d578158c0b2a6b7ed.tar.xz |
crypto: add NUMS_H const
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_framework_unit_tests.py | 1 | ||||
-rw-r--r-- | test/functional/test_framework/crypto/secp256k1.py | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/feature_framework_unit_tests.py b/test/functional/feature_framework_unit_tests.py index c9754e083c..f03f084bed 100755 --- a/test/functional/feature_framework_unit_tests.py +++ b/test/functional/feature_framework_unit_tests.py @@ -25,6 +25,7 @@ TEST_FRAMEWORK_MODULES = [ "crypto.muhash", "crypto.poly1305", "crypto.ripemd160", + "crypto.secp256k1", "script", "segwit_addr", "wallet_util", diff --git a/test/functional/test_framework/crypto/secp256k1.py b/test/functional/test_framework/crypto/secp256k1.py index 2e9e419da5..50a46dce37 100644 --- a/test/functional/test_framework/crypto/secp256k1.py +++ b/test/functional/test_framework/crypto/secp256k1.py @@ -15,6 +15,8 @@ Exports: * G: the secp256k1 generator point """ +import unittest +from hashlib import sha256 class FE: """Objects of this class represent elements of the field GF(2**256 - 2**32 - 977). @@ -344,3 +346,9 @@ class FastGEMul: # Precomputed table with multiples of G for fast multiplication FAST_G = FastGEMul(G) + +class TestFrameworkSecp256k1(unittest.TestCase): + def test_H(self): + H = sha256(G.to_bytes_uncompressed()).digest() + assert GE.lift_x(FE.from_bytes(H)) is not None + self.assertEqual(H.hex(), "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0") |