1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-04-27 16:38:39 +00:00

BIP374: Add message to rand computation (#1758)

* BIP374: Add message to rand computation

* BIP374: Update reference and test vectors

* Add changelog

* Format changelog according to BIP3

* Add creation date

Co-authored-by: Jon Atack <jon@atack.com>

* Grammar fix

Co-authored-by: Jon Atack <jon@atack.com>

* update changelog

---------

Co-authored-by: Jon Atack <jon@atack.com>
This commit is contained in:
Andrew Toth
2025-02-27 11:37:46 -05:00
committed by GitHub
parent cc81fde273
commit 24b4354e64
4 changed files with 34 additions and 24 deletions

View File

@@ -55,11 +55,14 @@ def dleq_generate_proof(
return None
if B.infinity:
return None
if m is not None:
assert len(m) == 32
A = a * G
C = a * B
t = xor_bytes(a.to_bytes(32, "big"), TaggedHash(DLEQ_TAG_AUX, r))
m_prime = bytes([]) if m is None else m
rand = TaggedHash(
DLEQ_TAG_NONCE, t + A.to_bytes_compressed() + C.to_bytes_compressed()
DLEQ_TAG_NONCE, t + A.to_bytes_compressed() + C.to_bytes_compressed() + m_prime
)
k = int.from_bytes(rand, "big") % GE.ORDER
if k == 0: