From 1350bc423e1417efb1b47e3e0c36ebc346d7388e Mon Sep 17 00:00:00 2001 From: Andrew Toth Date: Thu, 26 Dec 2024 12:06:44 -0500 Subject: [PATCH] BIP374 --- bip-DLEQ.mediawiki => bip-0374.mediawiki | 8 ++++---- bip-DLEQ/gen_test_vectors.py | 2 +- bip-DLEQ/reference.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename bip-DLEQ.mediawiki => bip-0374.mediawiki (97%) diff --git a/bip-DLEQ.mediawiki b/bip-0374.mediawiki similarity index 97% rename from bip-DLEQ.mediawiki rename to bip-0374.mediawiki index dd1f29c0..17947d7f 100644 --- a/bip-DLEQ.mediawiki +++ b/bip-0374.mediawiki @@ -71,14 +71,14 @@ The algorithm ''GenerateProof(a, B, r, G, m)'' is defined as: * Fail if ''is_infinite(B)''. * Let ''A = a⋅G''. * Let ''C = a⋅B''. -* Let ''t'' be the byte-wise xor of ''bytes(32, a)'' and ''hashBIP0???/aux(r)''. -* Let ''rand = hashBIP0???/nonce(t || cbytes(A) || cbytes(C))''. +* Let ''t'' be the byte-wise xor of ''bytes(32, a)'' and ''hashBIP0374/aux(r)''. +* Let ''rand = hashBIP0374/nonce(t || cbytes(A) || cbytes(C))''. * Let ''k = int(rand) mod n''. * Fail if ''k = 0''. * Let ''R1 = k⋅G''. * Let ''R2 = k⋅B''. * Let ''m' = m if m is provided, otherwise an empty byte array''. -* Let ''e = int(hashBIP0???/challenge(cbytes(A) || cbytes(B) || cbytes(C) || cbytes(G) || cbytes(R1) || cbytes(R2) || m'))''. +* Let ''e = int(hashBIP0374/challenge(cbytes(A) || cbytes(B) || cbytes(C) || cbytes(G) || cbytes(R1) || cbytes(R2) || m'))''. * Let ''s = (k + e⋅a) mod n''. * Let ''proof = bytes(32, e) || bytes(32, s)''. * If ''VerifyProof(A, B, C, proof)'' (see below) returns failure, abort. @@ -105,7 +105,7 @@ The algorithm ''VerifyProof(A, B, C, proof, G, m)'' is defined as: * Let ''R2 = s⋅B - e⋅C''. * Fail if ''is_infinite(R2)''. * Let ''m' = m if m is provided, otherwise an empty byte array''. -* Fail if ''e ≠ int(hashBIP0???/challenge(cbytes(A) || cbytes(B) || cbytes(C) || cbytes(G) || cbytes(R1) || cbytes(R2) || m'))''. +* Fail if ''e ≠ int(hashBIP0374/challenge(cbytes(A) || cbytes(B) || cbytes(C) || cbytes(G) || cbytes(R1) || cbytes(R2) || m'))''. * Return success iff no failure occurred before reaching this point. ==Backwards Compatibility== diff --git a/bip-DLEQ/gen_test_vectors.py b/bip-DLEQ/gen_test_vectors.py index 9c49744b..5d73757d 100755 --- a/bip-DLEQ/gen_test_vectors.py +++ b/bip-DLEQ/gen_test_vectors.py @@ -12,7 +12,7 @@ from secp256k1 import G, GE NUM_SUCCESS_TEST_VECTORS = 5 -DLEQ_TAG_TESTVECTORS_RNG = "BIP0???/testvectors_rng" +DLEQ_TAG_TESTVECTORS_RNG = "BIP0374/testvectors_rng" FILENAME_GENERATE_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_generate_proof.csv') FILENAME_VERIFY_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_verify_proof.csv') diff --git a/bip-DLEQ/reference.py b/bip-DLEQ/reference.py index f7e69c7b..e1e29cc7 100644 --- a/bip-DLEQ/reference.py +++ b/bip-DLEQ/reference.py @@ -7,9 +7,9 @@ import sys import unittest -DLEQ_TAG_AUX = "BIP0???/aux" -DLEQ_TAG_NONCE = "BIP0???/nonce" -DLEQ_TAG_CHALLENGE = "BIP0???/challenge" +DLEQ_TAG_AUX = "BIP0374/aux" +DLEQ_TAG_NONCE = "BIP0374/nonce" +DLEQ_TAG_CHALLENGE = "BIP0374/challenge" def TaggedHash(tag: str, data: bytes) -> bytes: