Skip to content

Latest commit

 

History

History
 
 

starknet-crypto

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Low-level cryptography utilities for StarkNet

starknet-crypto contains utilities for performing low-level cryptographic operations in StarkNet.

You're advised to use high-level crypto utilities implemented by the starknet-core crate (or use it through the starknet::core re-export) if you're not familiar with cryptographic primitives. Using these low-level functions incorrectly could result in leaking your private key, for example.

This library does not provide constant-time guarantees.

WARNING

While it has been tested against data randomly generated from cairo-lang, this crate is NOT audited or reviewed for security. Use at your own risk.

If you're a cryptographer, you're welcome to contribute by reviewing the implementation :)

Benchmark

On the author's machine with Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz running Ubuntu 20.04.2 LTS:

ecdsa_get_public_key    time:   [1.6202 ms 1.6309 ms 1.6425 ms]
ecdsa_sign              time:   [1.6612 ms 1.6754 ms 1.6912 ms]
ecdsa_verify            time:   [5.4950 ms 5.5259 ms 5.5599 ms]
pedersen_hash           time:   [3.1183 ms 3.1354 ms 3.1560 ms]
rfc6979_generate_k      time:   [10.625 us 10.691 us 10.770 us]

Credits

Most of the code in this crate for the Pedersen hash implementation was inspired and modified from the awesone pathfinder from Equilibrium.

Based on this solid foundation, ECDSA functionalities were inspired and ported from the crypto-cpp implementation from StarkWare.