{"id":21675066,"url":"https://github.com/alokmenghrajani/decv","last_synced_at":"2025-08-31T04:06:52.911Z","repository":{"id":46083214,"uuid":"252603522","full_name":"alokmenghrajani/decv","owner":"alokmenghrajani","description":"Deterministic ECDSA Cross Validation","archived":false,"fork":false,"pushed_at":"2023-07-25T21:44:47.000Z","size":563,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T04:39:28.145Z","etag":null,"topics":["bitcoin","crypto","cryptocurrency","cryptography","ecdsa","rfc6979","secp256k1"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alokmenghrajani.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,"zenodo":null}},"created_at":"2020-04-03T01:25:20.000Z","updated_at":"2024-02-26T16:01:24.000Z","dependencies_parsed_at":"2024-11-25T16:05:01.543Z","dependency_job_id":null,"html_url":"https://github.com/alokmenghrajani/decv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alokmenghrajani/decv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fdecv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fdecv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fdecv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fdecv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alokmenghrajani","download_url":"https://codeload.github.com/alokmenghrajani/decv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fdecv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272936421,"owners_count":25018160,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bitcoin","crypto","cryptocurrency","cryptography","ecdsa","rfc6979","secp256k1"],"created_at":"2024-11-25T13:50:52.708Z","updated_at":"2025-08-31T04:06:52.882Z","avatar_url":"https://github.com/alokmenghrajani.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deterministic ECDSA Cross Validation (DECV)\n\nThe purpose of DECV is to cross validate various different deterministic ECDSA implementations\n([libsecp256k1](https://github.com/bitcoin-core/secp256k1), [OpenSSL](https://github.com/openssl/openssl),\n[Trezor](https://github.com/trezor/trezor-firmware)). By verifying that each library produces the exact same signatures\nfor a large number of test vectors, we are able to confirm (with a high degree of confidence) that each library is both\ncorrect and lacks subliminal channels (also known as kleptograms). To learn more about ECDSA backdoors, see\n[\"Wallet Security\" by Stephan Verbücheln](https://media.ccc.de/v/35c3-9492-wallet_security) and [\"Deterministic\nSignatures, Subliminal channels and Hardware wallets\" by Sergio Demian\nLerner](https://bitslog.com/2014/06/09/deterministic-signatures-subliminal-channels-and-hardware-wallets/).\n\nWe focus on curve [secp256k1](https://en.bitcoin.it/wiki/Secp256k1) since our application is signing Bitcoin\ntransactions. Deterministic ECDSA is defined in [rfc6979](https://tools.ietf.org/html/rfc6979).\n\nAn ECDSA signature is represented as a pair of values (r, s). All implementations must generate the same r. However,\nthere exists two valid values for s: s and -s mod n (where n is the order of the group). Another Bitcoin-centric\ndecision is to always pick the lower s (see [BIP: 62](https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki),\n[BIP: 146](https://github.com/bitcoin/bips/blob/master/bip-0146.mediawiki)).\n\npython/decv.py is used to generate test vectors. These test vectors can be saved to a file or can be streamed to any\nother implementation. The test vectors also contain BIP32 derivations, which enables writing validation code which\nis as close as feasible to actual Bitcoin wallet code.\n\nNote:\n- libsecp256k1 and OpenSSL are used via [pycoin](https://github.com/richardkiss/pycoin), a python library.\n- trezor is compiled using cmake, with build files copied from [Subzero](https://github.com/square/subzero).\n\n# Running\n\nThe easiest way to run the code is to use [Docker](https://www.docker.com/), as following. The code should run fine\nwithout Docker, as long as the various dependencies are available. It is recommended that you validate your crypto\nlibrary in an environment identical to your production environment (i.e. it's preferable to validate hardware wallets on\nthe actual hardware since the underlying library might run different code paths on different processors).\n\n    $ docker build -t decv . \u0026\u0026 docker run --rm -it decv\n    # ./python/decv.py --libsecp256k1 generate 10000 | ./python/decv.py --libsecp256k1 verify\n    verified: 10000 signatures\n    # ./python/decv.py --libsecp256k1 generate 10000 | ./python/decv.py --openssl verify\n    verified: 10000 signatures    \n    # ./python/decv.py --libsecp256k1 generate 10000 | ./trezor/build/decv\n    verified: 10000 signatures\n    # cat bip32_test_vectors.csv | ./python/decv.py --libsecp256k1 verify\n    verified: 14 signatures\n    # cat bip32_test_vectors.csv | ./python/decv.py --openssl verify\n    verified: 14 signatures\n    # cat bip32_test_vectors.csv | ./trezor/build/decv\n    verified: 14 signatures\n    # exit\n\n# Test vector format\n\nThe test vectors are emitted using comma separated values (CSV). See following table for the field names and one sample\nrow.\n\n| seed (hex) | chain | ext pub (base58) | ext priv (base58) | hash of message (hex) | signature (DER encoded, low s, hex) |\n|------------|-------|------------------|-------------------|-----------------------|-------------------------------------|\n| 78c72a6f7a2a488de34a11c1a7de6ab97133d321 | m/0'/50/41/168'/115 | xpub6FRofRU8HUx9T1cZLAvV46p7EsKL4TK4NXq2H2iVLn2CYBcTUaNbftBMZT9qqEnynndSZVVJhWwJKhER99Sa3Tjt5pS3CnBrrna4bhCNexV | xprvA2STFuwET7PrEXY6E9PUgxsNgqUqezbD1JuRUeJsnSVDfPHJw34M85rsiBjERcEkunJ3kZ4N2Lg5xbbQ3UuastcwHVoF2H2ohpfSc4xV2GL | bd7b0690546402a37af52e513bcdf965c15c4757e82354944552140727e08ede | 304402201e924d772d72030794b25ea216298b57cbc09003f1db90691da1bfe1e292bd850220676f325432f9d14e7873cc64ea74ad88138c8e9a1793931a457523d7f7e4a79a |\n\n# Cross Validated Implementations\n\n| Library       | Version                                  |\n|---------------|------------------------------------------|\n| OpenSSL       | 1.1.1d                                   |\n| libsecp256k1  | 0.1~20170810-2                           |\n| trezor-crypto | e6d884b145d0fb6201c0ae76c552547028793df9 |\n\n# Releated and Future work\n\nIf you found DECV interesting or useful, you should check out [Project Wycheproof](https://github.com/google/wycheproof)\nand [Cryptofuzz - Differential cryptography fuzzing](https://github.com/guidovranken/cryptofuzz). Both project, using\ndifferent methodologies, look for bugs in cryptographic libraries.\n\nAt this point, DECV is considered complete and no future work is planned. However, we welcome pull requests which verify\nadditional libraries or which verify existing libraries using different programming language wrappers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokmenghrajani%2Fdecv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falokmenghrajani%2Fdecv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokmenghrajani%2Fdecv/lists"}