crypto

Some cryptograhpy functions for Sherlock.

Generating a private & public key pair from scratch.

pk = ed25519.Ed25519PrivateKey.generate()
pk
<cryptography.hazmat.bindings._rust.openssl.ed25519.Ed25519PrivateKey>
pub = pk.public_key().public_bytes_raw().hex()
pk, pub
(<cryptography.hazmat.bindings._rust.openssl.ed25519.Ed25519PrivateKey>,
 '25e06ab46f49f96c3a45b3a10a86d53362199cd32d7d7696c4ef08e678f2086e')

source

generate_keys

 generate_keys ()
generate_keys()
(<cryptography.hazmat.bindings._rust.openssl.ed25519.Ed25519PrivateKey>,
 '3abc35f7819d7edec58658199c0116a1eabdd6b0f91a096298b8dcbb0ab581f5')

Generating a pk instance and a public key from a private key in hex.

priv = pk.private_bytes_raw().hex()
pk = ed25519.Ed25519PrivateKey.from_private_bytes(bytes.fromhex(priv))
pk.public_key().public_bytes_raw().hex()
'25e06ab46f49f96c3a45b3a10a86d53362199cd32d7d7696c4ef08e678f2086e'

source

priv_key_hex

 priv_key_hex (pk)

source

from_pk_hex

 from_pk_hex (priv)
from_pk_hex(priv)
(<cryptography.hazmat.bindings._rust.openssl.ed25519.Ed25519PrivateKey>,
 '25e06ab46f49f96c3a45b3a10a86d53362199cd32d7d7696c4ef08e678f2086e')