Skip to content

Commit 60a0ff1

Browse files
committed
1 parent 2f73f08 commit 60a0ff1

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

hypercore_crypto/crypto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def discovery_key(public_key: bytes) -> bytes:
131131
132132
:param public_key: The public key for hashing
133133
"""
134-
return crypto_generichash(HYPERCORE, key=public_key)
134+
return crypto_generichash(HYPERCORE, k=public_key)
135135

136136

137137
def _to_unsigned_64_int(num: int) -> bytes:

test/test_crypto.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
from merkle_tree_stream import MerkleTreeNode
55
from pysodium import crypto_sign_PUBLICKEYBYTES, crypto_sign_SECRETKEYBYTES
66

7-
from hypercore_crypto import data, key_pair, parent, random_bytes, sign, verify
7+
from hypercore_crypto import (
8+
data,
9+
discovery_key,
10+
key_pair,
11+
parent,
12+
random_bytes,
13+
sign,
14+
verify,
15+
)
816

917

1018
def test_key_pair_seed_length():
@@ -59,3 +67,7 @@ def test_parent_digest():
5967
_parent.hex()
6068
== '43563406adba8b34b133fdca32d0a458c5be769615e01df30e6535ccd3c075f0'
6169
)
70+
71+
72+
def test_discovery_key_generated():
73+
assert discovery_key(random_bytes(32)) is not None

0 commit comments

Comments
 (0)