diff options
author | Jonas Nick <jonasd.nick@gmail.com> | 2019-08-26 20:46:08 +0000 |
---|---|---|
committer | Jonas Nick <jonasd.nick@gmail.com> | 2019-08-26 20:46:08 +0000 |
commit | 775cb2fd903cbfe459081fda49ada744ef3139be (patch) | |
tree | 871b1fe2fcb6d2b2007689e428c7ce24da7843bd /bip-schnorr/test-vectors.py | |
parent | 7cd53f6eec269c607605af6163eb1a8858ed79e1 (diff) | |
download | bips-775cb2fd903cbfe459081fda49ada744ef3139be.tar.xz |
Tag signature hashes, improve rationale and update test vectors
Diffstat (limited to 'bip-schnorr/test-vectors.py')
-rw-r--r-- | bip-schnorr/test-vectors.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bip-schnorr/test-vectors.py b/bip-schnorr/test-vectors.py index 45c8b1c..52e3b05 100644 --- a/bip-schnorr/test-vectors.py +++ b/bip-schnorr/test-vectors.py @@ -26,7 +26,7 @@ def vector1(): return (bytes_from_int(seckey), pubkey, msg, sig, "TRUE", None) def vector2(): - seckey = 0xC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B14E5C7 + seckey = 0xC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B14E5C9 msg = bytes_from_int(0x5E2D58D8B3BCDF1ABADEC7829054F90DDA9805AAB56C77333024B9D0A508B75C) sig = schnorr_sign(msg, seckey) @@ -53,7 +53,7 @@ def schnorr_sign_fixed_nonce(msg, seckey0, k): P = point_mul(G, seckey0) seckey = seckey0 if (jacobi(P[1]) == 1) else n - seckey0 R = point_mul(G, k) - e = int_from_bytes(hash_sha256(bytes_from_point(R) + bytes_from_point(P) + msg)) % n + e = int_from_bytes(tagged_hash("BIPSchnorr", bytes_from_point(R) + bytes_from_point(P) + msg)) % n return bytes_from_point(R) + bytes_from_int((k + e * seckey) % n) # Creates a singature with a small x(R) by using k = 1/2 |