Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/chilldkg_ref/chilldkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
`__all__` list. All other definitions are internal.
"""

from secrets import token_bytes as random_bytes
from typing import Any, Tuple, List, NamedTuple, NewType, Optional, NoReturn, Dict

from secp256k1lab.secp256k1 import Scalar, GE
Expand Down Expand Up @@ -80,7 +79,7 @@ def certeq_message(x: bytes, idx: int) -> bytes:

def certeq_participant_step(hostseckey: bytes, idx: int, x: bytes) -> bytes:
msg = certeq_message(x, idx)
return schnorr_sign(msg, hostseckey, aux_rand=random_bytes(32))
return schnorr_sign(msg, hostseckey, aux_rand=b"\x00" * 32)


def certeq_cert_len(n: int) -> int:
Expand Down
2 changes: 1 addition & 1 deletion python/chilldkg_ref/encpedpop.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def participant_step2(
# Translate simplpedpop.ParticipantInvestigationData into our own
# encpedpop.ParticipantInvestigationData.
inv_data = ParticipantInvestigationData(e.inv_data, enc_secshare, pads)
raise UnknownFaultyParticipantOrCoordinatorError(inv_data, e.args) from e
raise UnknownFaultyParticipantOrCoordinatorError(inv_data, *e.args) from e

eq_input += b"".join(enckeys) + b"".join(pubnonces)
return dkg_output, eq_input
Expand Down
3 changes: 1 addition & 2 deletions python/chilldkg_ref/simplpedpop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from secrets import token_bytes as random_bytes
from typing import List, NamedTuple, NewType, Tuple, Optional, NoReturn

from secp256k1lab.bip340 import schnorr_sign, schnorr_verify
Expand Down Expand Up @@ -37,7 +36,7 @@ def pop_msg(idx: int) -> bytes:

def pop_prove(seckey: bytes, idx: int) -> Pop:
sig = schnorr_sign(
pop_msg(idx), seckey, aux_rand=random_bytes(32), tag_prefix=POP_MSG_TAG
pop_msg(idx), seckey, aux_rand=b"\x00" * 32, tag_prefix=POP_MSG_TAG
)
return Pop(sig)

Expand Down
8 changes: 8 additions & 0 deletions python/secp256k1lab/secp256k1.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ def from_bytes(b):
else:
return GE.from_bytes_uncompressed(b)

@staticmethod
def from_bytes_with_infinity(b):
"""Convert a compressed or uncompressed encoding to a group element, mapping zeros to infinity."""
if b == 33 * b"\x00":
return GE()
else:
return GE.from_bytes(b)

@staticmethod
def from_bytes_xonly(b):
"""Convert a point given in xonly encoding to a group element."""
Expand Down
Loading