The Fresh Crypto Lib is a set of functions for blockchain systems such as Wallet, SmartContracts.
The implemented content is:
- sec256r1 optimizations for EVM chains and Starknet
- an ecdaa implementation using blockchain primitives
- a Starknet dedicated musig2 implementation
- FCL_elliptic.sol: an EVM optimized implementation of sec256r1(P256), using language hacks and specificities, as described in paper https://eprint.iacr.org/2023/939.pdf.
- FCL_eddsa.sol : an EVM optimized implementation of ed25519, using same paper tricks.
- FCL_sha512.sol : implementation of the SHA512 primitive (WIP, not working)
- FLC_Webauthn.sol: implementation of the WebAuthn2/FIDO2 authentication over ECDSA with P256
- FCL_ec_mulmuladd.cairo: an implementation of the operation aP+bQ (addition of the results of two distincts point multiplication by scalar a and b). It uses the Shamir's trick with the windowing method. signature_opt.cairo : optimisation of ECDSA verification using ec_mulmuladd_W function
- FCL_ecdsa_precompute.sage : precompute bytecode contract to speed up ecdsa verification for a given key.
- FCL_ecdaa : sage reference for a blockchain implementation of ECDAA
- FCL_pairings : sage implementation of curve and pairing computation over BN254 (aka altbn128) and BLS12381 using INRIA sources.
The following repos are used as building blocks in the FCL:
- Aurore Guillevic's Gitlab at INRIA: https://gitlab.inria.fr/tnfs-alpha/alpha/-/tree/190b87732901750ed1438a8cf340571531d32230/sage/tnfs for its generic sagemath BN and BLS curves and pairing implementation.
- Paul Miller Noble javascript library for its G1 implementation of BN254 and BLS12, and keccak256. https://paulmillr.com/noble/
The following repos have been used in benchmarks:
- Alembic/cometh:https://github.com/alembic-tech/P256-verify-signature/blob/main/contracts/EllipticCurve.sol
- MaxRobot : https://github.com/maxrobot/elliptic-solidity
- Numerology : https://github.com/nucypher/numerology
- Obvious : https://github.com/itsobvioustech/aa-passkeys-wallet
- Academic paper: https://eprint.iacr.org/2023/939 for EthCC2023
- Braavos https://github.com/myBraavos/efficient-secp256r1/blob/develop/src/secp256r1/ec_mulmuladd.cairo
- Cartridge cartridge-gg/cairo-secp256r1#3
- EIP665 PR#7515 :ethereum/EIPs#7515
- Presentation made at EthCC 2023 in Paris: https://www.youtube.com/live/Rlq21oA_FA8
License: This software is licensed under MIT License (see LICENSE FILE at root directory of project).