Expand description
Low-level cryptography utilities for Starknet. Features include:
- ECDSA operations
- Pedersen hash
- Poseidon hash
- RFC-6979
§Warning
You’re advised to use high-level crypto utilities implemented by the starknet-core
crate if
you’re not familiar with cryptographic primitives. Using these low-level functions incorrectly
could result in catastrophic consequences like leaking your private key.
Structs§
- Stark ECDSA signature with
v
, useful for recovering the public key. - Definition of the Field Element type.
- A stateful hasher for Starknet Poseidon hash.
- Stark ECDSA signature.
Enums§
- Errors when performing ECDSA
recover
operations. - Errors when performing ECDSA
sign
operations. - Errors when performing ECDSA
verify
operations.
Functions§
- Computes the public key given a Stark private key.
- Computes the Starkware version of the Pedersen hash of x and y. All inputs are little-endian.
- Computes the Starknet Poseidon hash of x and y.
- Computes the Starknet Poseidon hash of an arbitrary number of
Felt
s. - Computes the Starknet Poseidon hash of a single
Felt
. - Poseidon permutation function.
- Recovers the public key from a message and (r, s, v) signature parameters
- Deterministically generate ephemeral scalar
k
based on RFC 6979. - Computes ECDSA signature given a Stark private key and message hash.
- Verifies if a signature is valid over a message hash given a public key. Returns an error instead of
false
if the public key is invalid.