py-libp2p/tests/peer/test_peerid.py

11 lines
310 B
Python
Raw Normal View History

from Crypto.PublicKey import RSA
2019-01-10 02:38:56 +08:00
from libp2p.peer.id import id_from_private_key, id_from_public_key
def test_id_from_private_key():
key = RSA.generate(2048, e=65537)
id_from_pub = id_from_public_key(key.publickey())
id_from_priv = id_from_private_key(key)
assert id_from_pub == id_from_priv