Ed25519

Bindings for EdDSA.

pyhacl.signature.ed25519.secret_to_public(private_key: bytes) bytes

Compute the public key from the private key.

Parameters:

private_key – The 32 bytes private key.

Returns:

A 32 bytes public key.

Raises:

ValueError – When the key has an incorrect length.

Uses Hacl_Ed25519_secret_to_public.

pyhacl.signature.ed25519.sign(private_key: bytes, message: bytes) bytes

Sign the message.

Parameters:
  • message – The message (of any length) to be signed.

  • private_key – The 32 bytes private key used to sign the message.

Returns:

The 64 bytes signature.

Raises:

ValueError – When the key has incorrect length.

Binding for Hacl_Ed25519_sign.

pyhacl.signature.ed25519.verify(public_key: bytes, message: bytes, signature: bytes) bool

Verify that the signature matches the message.

Parameters:
  • public_key – The 32-bytes public key used to verify the signature.

  • message – The message for which signature was computed.

  • signature – The 64 bytes signature to verify.

Returns:

True when the signature matches, False otherwise.

Raises:

ValueError – When the key or signature has incorrect length.

Binding for Hacl_Ed25519_verify.