Crate starknet_crypto

Source
Expand description

Low-level cryptography utilities for Starknet. Features include:

§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§

Enums§

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 Felts.
  • 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.