/sec256r1

Cryptographic Primitives for Blockchain Systems (solidity, cairo, C and rust)

Primary LanguageSolidityMIT LicenseMIT

Fresh Crypto Lib (FCL)

The Fresh Crypto Lib is a set of functions for blockchain systems such as Wallet, SmartContracts.

Content

The implemented content is:

  • sec256r1 optimizations for EVM chains and Starknet
  • an ecdaa implementation using blockchain primitives
  • a Starknet dedicated musig2 implementation

Directory solidity:

  • 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

Directory cairo0.9:

  • 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

Directory sage:

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

Acknowledments:

Building Blocks

The following repos are used as building blocks in the FCL:

Benchmark

The following repos have been used in benchmarks:

FCL in the wild

License

License: This software is licensed under MIT License (see LICENSE FILE at root directory of project).