{"id":23544400,"url":"https://github.com/rdubois-crypto/freshcryptolib","last_synced_at":"2025-02-27T16:18:45.212Z","repository":{"id":163466770,"uuid":"614408924","full_name":"rdubois-crypto/FreshCryptoLib","owner":"rdubois-crypto","description":"Cryptographic Primitives for Blockchain Systems (solidity, cairo, C and rust)","archived":false,"fork":false,"pushed_at":"2024-08-29T08:47:11.000Z","size":42031,"stargazers_count":134,"open_issues_count":1,"forks_count":23,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-20T15:08:05.385Z","etag":null,"topics":["ecdsa","fido2","secp256r1","solidity","webauthn-demo"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdubois-crypto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T14:26:06.000Z","updated_at":"2025-02-14T21:40:07.000Z","dependencies_parsed_at":"2023-10-22T17:28:38.641Z","dependency_job_id":"b7de178d-a69a-4cb7-a3e6-2eff86c800f2","html_url":"https://github.com/rdubois-crypto/FreshCryptoLib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdubois-crypto%2FFreshCryptoLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdubois-crypto%2FFreshCryptoLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdubois-crypto%2FFreshCryptoLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdubois-crypto%2FFreshCryptoLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdubois-crypto","download_url":"https://codeload.github.com/rdubois-crypto/FreshCryptoLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240794979,"owners_count":19858722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecdsa","fido2","secp256r1","solidity","webauthn-demo"],"created_at":"2024-12-26T07:15:09.619Z","updated_at":"2025-02-27T16:18:45.160Z","avatar_url":"https://github.com/rdubois-crypto.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fresh Crypto Lib (FCL)\n\nThe Fresh Crypto Lib is a set of functions for blockchain systems such as Wallet, SmartContracts.\n\n*** __15/05/24 : Deprecated__\n\n*** __This library is an experimental prequel of SCL. SCL proposes more generic implementation with RIP7696 for lesser cost (beating record set by FCL) and is currently under audit.\nhttps://github.com/get-smooth/crypto-lib__.\n\n*** __new (27/05/24): SCL now supports both Ed25519 and P256 using RIP7696__.\n\n*** __new (06/08/24): SCL first audit completed, second VERIDISE audit being reviewed__ (FCL has no audit).\n\n*** We warmly thanks all contributors of FCL, they will be added as contributor to SCL.\n\n## Content\n\nThe implemented content is:\n- sec256r1 optimizations for EVM chains and Starknet\n- an ecdaa implementation using blockchain primitives\n- a Starknet dedicated musig2 implementation\n\n\n### Directory solidity:\n\n* FCL_ecdsa.sol: an EVM optimized implementation of ecdsa over sec256r1(P256), using language hacks and specificities, as described in paper https://eprint.iacr.org/2023/939.pdf.\n* FCL_eddsa.sol   : an EVM optimized implementation of ed25519, using same paper tricks.\n* FCL_sha512.sol : implementation of the SHA512 primitive (single bloc implementation)\n* FLC_Webauthn.sol: implementation of the WebAuthn2/FIDO2 authentication over ECDSA with P256\n\u003c!--- FCL_ecdaa.sol: an EVM version of the ECDAA anonymous attestation for anonymous airdrops --\u003e\n\n\n| PR # | Create2 | Mainnets | Testnets |\n|--------:|---------|:--:|:----|\n||         |  |         |\n|[46](https://github.com/rdubois-crypto/FreshCryptoLib/pull/46)| 0xE9399D1183a5cf9E14B120875A616b6E2bcB840a    | [Polygon](https://polygonscan.com/address/0xe9399d1183a5cf9e14b120875a616b6e2bcb840a#code)  | [Optimism](https://goerli-optimism.etherscan.io/address/0xe9399d1183a5cf9e14b120875a616b6e2bcb840a#code), [Sepolia](https://sepolia.etherscan.io/address/0xe9399d1183a5cf9e14b120875a616b6e2bcb840a#code), [Linea](https://explorer.goerli.linea.build/address/0xE9399D1183a5cf9E14B120875A616b6E2bcB840a/contracts#address-tabs)  |  \n\n(code is verified except for linea, one could check that bytecode is identical).\n\n### Directory cairo0.9:\n\n* 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.\nsignature_opt.cairo : optimisation of ECDSA verification using ec_mulmuladd_W function\n\n\u003c!---* FCL_cairo_secp : optimization of the ECDSA function over sec256r1, using starkware implementation with ec_mulmuladdW_sec256k1 (original implementation from Starkware commons here:https://github.com/https://github.com/starkware-libs/cairo-lang/tree/master/src/starkware/cairo/common/cairo_secp)--\u003e\n\n\u003c!---* FCL_cairo_secp256k1 : optimization of the ECDSA function over sec256k1 using ec_mulmuladdW_sec256r1 (original implementation from Cartridge here:https://github.com/cartridge-gg/cairo-secp256r1) --\u003e\n\n\n\u003c!---*FCL_musig2: Original implementation of the Schnorr verification algorithm. Please note that it is a custom implementation (cryptographically equivalent, but not identical to BlockStream implementation).\nNamely arbitrary domain separator, choice of hash, byte ordering and annoying little choices are not compatible with Musig2 BIP proposal.--\u003e\n\nNote : The language is now deprecated since its transition from python-like to rust-like language.\n\n### Directory sage:\n\n* FCL_ecdsa_precompute.sage : precompute bytecode contract to speed up ecdsa verification for a given key.\n* FCL_ecdaa : sage reference for a blockchain implementation of ECDAA\n* FCL_pairings : sage implementation of curve and pairing computation over BN254 (aka altbn128) and BLS12381 using INRIA sources.\n\n\n### Acknowledments:\n\n\n#### Building Blocks\n\nThe following repos are used as building blocks in the FCL:\n* 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.\n* Paul Miller **Noble** javascript library for its G1 implementation of BN254 and BLS12, and keccak256. https://paulmillr.com/noble/\n\n#### Benchmark\n\nThe following repos have been used in benchmarks:\n* Alembic/cometh:https://github.com/alembic-tech/P256-verify-signature/blob/main/contracts/EllipticCurve.sol\n* MaxRobot : https://github.com/maxrobot/elliptic-solidity\n* Numerology : https://github.com/nucypher/numerology\n* Obvious : https://github.com/itsobvioustech/aa-passkeys-wallet\n\n\n#### Testing \n\n* Invariant test vectors are extracted from the wycheproof project : https://github.com/google/wycheproof\n\n### FCL in the wild\n\n* Academic paper: https://eprint.iacr.org/2023/939 for EthCC2023\n* Alembic : https://github.com/alembic-tech/p256-signer/blob/main/contracts/FCL/FCL_elliptic.sol\n* Base Smart Wallet: fast onboarding using FCL: https://www.smart-wallet.xyz/, deployed at 0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a (Base main and Sepolia)\n* Braavos https://github.com/myBraavos/efficient-secp256r1/blob/develop/src/secp256r1/ec_mulmuladd.cairo\n* Cartridge https://github.com/cartridge-gg/cairo-secp256r1/pull/3\n* EIP665 PR#7515 :https://github.com/ethereum/EIPs/pull/7515\n* Presentation made at EthCC 2023 in Paris: https://www.youtube.com/live/Rlq21oA_FA8\n* Forum DAO,  :https://github.com/forumdaos/forum-contracts/tree/main/src/libraries\n* Daimo, ethereum payments : https://github.com/daimo-eth/p256-verifier/blob/master/src/P256Verifier.sol\n* Safe : https://github.com/safe-global/safe-modules/tree/master/4337/contracts/test/FCL\n* SoulWallet : https://github.com/SoulWallet/soul-wallet-contract/blob/a0146910dfbc46afeba809b26f256129d37e3301/contracts/libraries/WebAuthn.sol#L69\n* Wallet Abstraction, EthGlobal NY hackathon finalist : https://github.com/qd-qd/wallet-abstraction\n* Wax : Wallet Account Experiments, PSE team (EF funded) https://github.com/getwax/wax/commit/fd246685f67ebb56f5ebb82cb48df56088e28c7b  \n\nDo not hesitate to reach us to be listed.\n## License \nLicense: This software is licensed under MIT License (see LICENSE FILE at root directory of project).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdubois-crypto%2Ffreshcryptolib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdubois-crypto%2Ffreshcryptolib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdubois-crypto%2Ffreshcryptolib/lists"}