{"id":37067916,"url":"https://github.com/jhtitor/secp256k1prp-py","last_synced_at":"2026-01-14T07:58:58.791Z","repository":{"id":57465138,"uuid":"127543066","full_name":"jhtitor/secp256k1prp-py","owner":"jhtitor","description":"Python FFI bindings for secp256k1 :dizzy: with Pedersen/Rangeproof commitments","archived":false,"fork":true,"pushed_at":"2018-07-10T23:45:32.000Z","size":217,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-15T00:01:56.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ludbb/secp256k1-py","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhtitor.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}},"created_at":"2018-03-31T15:08:51.000Z","updated_at":"2025-03-26T03:48:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jhtitor/secp256k1prp-py","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jhtitor/secp256k1prp-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhtitor%2Fsecp256k1prp-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhtitor%2Fsecp256k1prp-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhtitor%2Fsecp256k1prp-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhtitor%2Fsecp256k1prp-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhtitor","download_url":"https://codeload.github.com/jhtitor/secp256k1prp-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhtitor%2Fsecp256k1prp-py/sbom","scorecard":{"id":519174,"data":{"date":"2025-08-11","repo":{"name":"github.com/jhtitor/secp256k1prp-py","commit":"fcf43ca250515da82b67d90729e3fa952a18d7d6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: pipCommand not pinned by hash: .travis/deploy.sh:19","Warn: pipCommand not pinned by hash: .travis/deploy.sh:26","Warn: pipCommand not pinned by hash: .travis/install.sh:88","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.13.2.5prp not signed: https://api.github.com/repos/jhtitor/secp256k1prp-py/releases/10354699","Warn: release artifact 0.13.2.5prp does not have provenance: https://api.github.com/repos/jhtitor/secp256k1prp-py/releases/10354699"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T02:32:45.658Z","repository_id":57465138,"created_at":"2025-08-20T02:32:45.658Z","updated_at":"2025-08-20T02:32:45.658Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-14T07:58:58.068Z","updated_at":"2026-01-14T07:58:58.785Z","avatar_url":"https://github.com/jhtitor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secp256k1-py _prp FORK\n\nOriginally:\n\nPython FFI bindings for [libsecp256k1](https://github.com/bitcoin/secp256k1)\n(an experimental and optimized C library for EC operations on curve secp256k1).\n\nThis fork:\n\nUses a [specific version of libsecp256k1][zkp], with Pedersen / Pangeproof\nfunctions, useful for BitShares and other coins.\n\n [zkp]: https://github.com/sipa/secp256k1-zkp/commit/35932bb24e83257b737a8ab4da0816972f4c252a\n\nThis fork is probably in conflic with both upstream and other secp256k1 wrappers.\nFor completeness sake, this version includes both Schnorr, Pedersen and all\nthe rest of the functions, so it should be usable in most situations.\n\n## Installation\n\n```\npip install secp256k1prp\n```\n\n### Precompiled binary packages (wheels)\n\nPrecompiled binary wheels are available for some systems.\nTo take advantage of those you need to use pip \u003e= 8.1.0.\n\nIf you're downloading manually, run\n\n```\npip install secp256k1prp-SOME_WHEEL_FILE.whl\n```\n\nSee [Releases](https://github.com/jhtitor/secp256k1prp-py/releases)\nand [pypi](https://pypi.org/project/secp256k1prp/#files).\n\n\u003cs\u003e\nIn case you don't want to use the binary packages you can prevent pip from\nusing them with the following command:\n\n```\npip install --no-binary secp256k1prp\n```\n\u003c/s\u003e\n\n### Installation with compilation\n\nIf you either can't or don't want to use the binary package options described\nabove read on to learn what is needed to install the source pacakge.\n\nThere are two modes of installation depending on whether you already have\nlibsecp256k1 installed on your system:\n\n\n###### Using a system installed libsecp256k1\n\n\u003cs\u003e\nIf the library is already installed it should usually be automatically detected\nand used.\nHowever if libsecp256k1 is installed in a non standard location you can use the\nenvironment variables `INCLUDE_DIR` and `LIB_DIR` to point the way:\n\n```\nINCLUDE_DIR=/opt/somewhere/include LIB_DIR=/opt/somewhere/lib pip install --no-binary secp256k1\n```\n\u003c/s\u003e\n\nNote: not supported.\n\n###### Using the bundled libsecp256k1\n\nIf on the other hand you don't have libsecp256k1 installed on your system, a\nbundled version will be built and used. In this case only the `recovery` module\nwill be enabled since it's the only one not currently considered as\n\"experimental\" by the library authors. This can be overridden by setting the\n`SECP_BUNDLED_EXPERIMENTAL` environment variable:\n\n```\nSECP_BUNDLED_EXPERIMENTAL=1 pip install --no-binary secp256k1prp\n```\n\nFor the bundled version to compile successfully you need to have a C compiler\nas well as the development headers for `libffi` and `libgmp` installed.\n\nOn Debian / Ubuntu for example the necessary packages are:\n\n* `build-essential`\n* `automake`\n* `pkg-config`\n* `libtool`\n* `libffi-dev`\n* `libgmp-dev`\n\nOn OS X the necessary homebrew packages are:\n\n* `automake`\n* `pkg-config`\n* `libtool`\n* `libffi`\n* `gmp`\n\nWindows XP + MSYS2:\n\n* use [msys2-i686-20160205.exe][1]\n* DO NOT upgrade pacman package index (`-Syu, -Su` - don't run those)\n* `python`\n* `gcc`\n* `make`\n* `python -m ensurepip --default-pip`\n* `libffi-devel`\n* `gmp`\n\n[1]: http://repo.msys2.org/distrib/i686/msys2-i686-20160205.exe\n\nWindows XP native:\n\n* install [Visual C++ 2010][2]\n* install [python 3.4.4][3]\n\n[2]: https://download.my.visualstudio.com/db/en_visual_studio_2010_express_x86_dvd_510419.iso\n[3]: https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi\n\nWindows 7+\n\n* install [.NET Framework 4.6][4] or higher\n* install [Visual C++ 14.0][5] from \"Microsoft Visual C++ Build Tools\"\n* install [python 3.6.5][6] or later\n\n[4]: https://www.microsoft.com/en-us/download/details.aspx?id=48137\n[5]: https://landinghub.visualstudio.com/visual-cpp-build-tools\n[6]: https://www.python.org/download/windows\n\nNote: for python 3.5 builds, download and install [Visual Studio 2015][7]\n\n[7]: https://www.microsoft.com/en-en/SoftMicrosoft/vs2015professional.aspx\n\n## Command line usage\n\n###### Generate a private key and show the corresponding public key\n\n```\n$ python -m secp256k1 privkey -p\n\na1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e\nPublic key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3\n```\n\n###### Sign a message\n\n```\n$ python -m secp256k1 sign \\\n\t-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \\\n\t-m hello\n\n3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369\n```\n\n###### Check signature\n\n```\n$ python -m secp256k1 checksig \\\n\t-p 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3 \\\n\t-m hello \\\n\t-s 3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369\n\nTrue\n```\n\n###### Generate a signature that allows recovering the public key\n\n```\n$ python -m secp256k1 signrec \\\n\t-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \\\n\t-m hello\n\n515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 1\n```\n\n###### Recover public key\n\n```\n$ python -m secp256k1 recpub \\\n\t-s 515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 \\\n\t-i 1 \\\n\t-m hello\n\nPublic key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3\n```\n\n\nIt is easier to get started with command line, but it is more common to use this as a library. For that, check the next sections.\n\n\n## API\n\n#### class `secp256k1.PrivateKey(privkey, raw, flags)`\n\nThe `PrivateKey` class loads or creates a private key by obtaining 32 bytes from urandom and operates over it.\n\n##### Instantiation parameters\n\n- `privkey=None` - generate a new private key if None, otherwise load a private key.\n- `raw=True` - if `True`, it is assumed that `privkey` is just a sequence of bytes, otherwise it is assumed that it is in the DER format. This is not used when `privkey` is not specified.\n- `flags=secp256k1.ALL_FLAGS` - see Constants.\n\n##### Methods and instance attributes\n\n- `pubkey`: an instance of `secp256k1.PublicKey`.\n- `private_key`: raw bytes for the private key.\n\n- `set_raw_privkey(privkey)`\u003cbr/\u003e\nupdate the `private_key` for this instance with the bytes specified by `privkey`. If `privkey` is invalid, an Exception is raised. The `pubkey` is also updated based on the new private key.\n\n- `serialize()` -\u003e bytes\u003cbr/\u003e\nconvert the raw bytes present in `private key` to a hexadecimal string.\n\n- `deserialize(privkey_ser)` -\u003e bytes\u003cbr/\u003e\nconvert from a hexadecimal string to raw bytes and update the `pubkey` and `private_key` for this instance.\n\n- `tweak_add(scalar)` -\u003e bytes\u003cbr/\u003e\ntweak the current private key by adding a 32 byte scalar to it and return a new raw private key composed of 32 bytes.\n\n- `tweak_mul(scalar)` -\u003e bytes\u003cbr/\u003e\ntweak the current private key by multiplying it by a 32 byte scalar and return a new raw private key composed of 32 bytes.\n\n- `ecdsa_sign(msg, raw=False, digest=hashlib.sha256)` -\u003e internal object\u003cbr/\u003e\nby default, create an ECDSA-SHA256 signature from the bytes in `msg`. If `raw` is True, then the `digest` function is not applied over `msg`, otherwise the `digest` must produce 256 bits or an `Exception` will be raised.\u003cbr/\u003e\u003cbr/\u003e\nThe returned object is a structure from the C lib. If you want to store it (on a disk or similar), use `ecdsa_serialize` and later on use `ecdsa_deserialize` when loading.\n\n- `ecdsa_sign_recoverable(msg, raw=False, digest=hashlib.sha256)` -\u003e internal object\u003cbr/\u003e\ncreate a recoverable ECDSA signature. See `ecdsa_sign` for parameters description.\n\n\u003e NOTE: `ecdsa_sign_recoverable` can only be used if the `secp256k1` C library is compiled with support for it. If there is no support, an Exception will be raised when calling it.\n\n- `schnorr_sign(msg, raw=False, digest=hashlib.sha256)` -\u003e bytes\u003cbr/\u003e\ncreate a signature using a custom EC-Schnorr-SHA256 construction. It\nproduces non-malleable 64-byte signatures which support public key recovery\nbatch validation, and multiparty signing. `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\n\n- `schnorr_generate_nonce_pair(msg, raw=False, digest=hashlib.sha256)` -\u003e (internal object, internal object)\u003cbr/\u003e\ngenerate a nonce pair deterministically for use with `schnorr_partial_sign`. `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\n\n- `schnorr_partial_sign(msg, privnonce, pubnonce_others, raw=False, digest=hashlib.sha256)` -\u003e bytes\u003cbr/\u003e\nproduce a partial Schnorr signature, which can be combined using `schnorr_partial_combine` to end up with a full signature that is verifiable using `PublicKey.schnorr_verify`. `privnonce` is the second item in the tuple returned by `schnorr_generate_nonce_pair`, `pubnonce_others` represent the combined public nonces excluding the one associated to this `privnonce`. `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\u003cbr/\u003e\u003cbr/\u003e\nTo combine pubnonces, use `PublicKey.combine`.\u003cbr/\u003e\u003cbr/\u003e\nDo not pass the pubnonce produced for the respective privnonce; combine the pubnonces from other signers and pass that instead.\n\n\n#### class `secp256k1.PublicKey(pubkey, raw, flags)`\n\nThe `PublicKey` class loads an existing public key and operates over it.\n\n##### Instantiation parameters\n\n- `pubkey=None` - do not load a public key if None, otherwise do.\n- `raw=False` - if `False`, it is assumed that `pubkey` has gone through `PublicKey.deserialize` already, otherwise it must be specified as bytes.\n- `flags=secp256k1.FLAG_VERIFY` - see Constants.\n\n##### Methods and instance attributes\n\n- `public_key`: an internal object representing the public key.\n\n- `serialize(compressed=True)` -\u003e bytes\u003cbr/\u003e\nconvert the `public_key` to bytes. If `compressed` is True, 33 bytes will be produced, otherwise 65 will be.\n\n- `deserialize(pubkey_ser)` -\u003e internal object\u003cbr/\u003e\nconvert the bytes resulting from a previous `serialize` call back to an internal object and update the `public_key` for this instance. The length of `pubkey_ser` determines if it was serialized with `compressed=True` or not. This will raise an Exception if the size is invalid or if the key is invalid.\n\n- `combine(pubkeys)` -\u003e internal object\u003cbr/\u003e\ncombine multiple public keys (those returned from `PublicKey.deserialize`) and return a public key (which can be serialized as any other regular public key). The `public_key` for this instance is updated to use the resulting combined key. If it is not possible the combine the keys, an Exception is raised.\n\n- `tweak_add(scalar)` -\u003e internal object\u003cbr/\u003e\ntweak the current public key by adding a 32 byte scalar times the generator to it and return a new PublicKey instance.\n\n- `tweak_mul(scalar)` -\u003e internal object\u003cbr/\u003e\ntweak the current public key by multiplying it by a 32 byte scalar and return a new PublicKey instance.\n\n- `ecdsa_verify(msg, raw_sig, raw=False, digest=hashlib.sha256)` -\u003e bool\u003cbr/\u003e\nverify an ECDSA signature and return True if the signature is correct, False otherwise. `raw_sig` is expected to be an object returned from `ecdsa_sign` (or if it was serialized using `ecdsa_serialize`, then first run it through `ecdsa_deserialize`). `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\n\n- `schnorr_verify(msg, schnorr_sig, raw=False, digest=hashlib.sha256)` -\u003e bool\u003cbr/\u003e\nverify a Schnorr signature and return True if the signature is correct, False otherwise. `schnorr_sig` is expected to be the result from either `schnorr_partial_combine` or `schnorr_sign`. `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\n\n- `ecdh(scalar)` -\u003e bytes\u003cbr/\u003e\ncompute an EC Diffie-Hellman secret in constant time. The instance `public_key` is used as the public point, and the `scalar` specified must be composed of 32 bytes. It outputs 32 bytes representing the ECDH secret computed. If the `scalar` is invalid, an Exception is raised.\n\n\u003e NOTE: `ecdh` can only be used if the `secp256k1` C library is compiled with support for it. If there is no support, an Exception will be raised when calling it.\n\n\n#### class `secp256k1.ECDSA`\n\nThe `ECDSA` class is intended to be used as a mix in. Its methods can be accessed from any `secp256k1.PrivateKey` or `secp256k1.PublicKey` instances.\n\n##### Methods\n\n- `ecdsa_serialize(raw_sig)` -\u003e bytes\u003cbr/\u003e\nconvert the result from `ecdsa_sign` to DER.\n\n- `ecdsa_deserialie(ser_sig)` -\u003e internal object\u003cbr/\u003e\nconvert DER bytes to an internal object.\n\n- `ecdsa_serialize_compact(raw_sig)` -\u003e bytes\u003cbr/\u003e\nconvert the result from `ecdsa_sign` to a compact serialization of 64 bytes.\n\n- `ecdsa_deserialize_compact(ser_sig)` -\u003e internal object\u003cbr/\u003e\nconvert a compact serialization of 64 bytes to an internal object.\n\n- `ecdsa_signature_normalize(raw_sig, check_only=False)` -\u003e (bool, internal object | None)\u003cbr/\u003e\ncheck and optionally convert a signature to a normalized lower-S form. If `check_only` is True then the normalized signature is not returned.\u003cbr/\u003e\u003cbr/\u003e\nThis function always return a tuple containing a boolean (True if not previously normalized or False if signature was already normalized), and the normalized signature. When `check_only` is True, the normalized signature returned is always None.\n\n- `ecdsa_recover(msg, recover_sig, raw=False, digest=hashlib.sha256)` -\u003e internal object\u003cbr/\u003e\nrecover an ECDSA public key from a signature generated by `ecdsa_sign_recoverable`. `recover_sig` is expected to be an object returned from `ecdsa_sign_recoverable` (or if it was serialized using `ecdsa_recoverable_serialize`, then first run it through `ecdsa_recoverable_deserialize`). `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\u003cbr/\u003e\u003cbr/\u003e\nIn order to call `ecdsa_recover` from a `PublicKey` instance, it's necessary to create the instance by settings `flags` to `ALL_FLAGS`: `secp256k1.PublicKey(..., flags=secp256k1.ALL_FLAGS)`.\n\n- `ecdsa_recoverable_serialize(recover_sig)` -\u003e (bytes, int)\u003cbr/\u003e\nconvert the result from `ecdsa_sign_recoverable` to a tuple composed of 65 bytesand an integer denominated as recovery id.\n\n- `ecdsa_recoverable_deserialize(ser_sig, rec_id)`-\u003e internal object\u003cbr/\u003e\nconvert the result from `ecdsa_recoverable_serialize` back to an internal object that can be used by `ecdsa_recover`.\n\n- `ecdsa_recoverable_convert(recover_sig)` -\u003e internal object\u003cbr/\u003e\nconvert a recoverable signature to a normal signature, i.e. one that can be used by `ecdsa_serialize` and related methods.\n\n\u003e NOTE: `ecdsa_recover*` can only be used if the `secp256k1` C library is compiled with support for it. If there is no support, an Exception will be raised when calling any of them.\n\n\n#### class `secp256k1.Schnorr`\n\nThe `Schnorr` class is intended to be used as a mix in. Its methods can be accessed from any `secp256k1.PrivateKey` or `secp256k1.PublicKey` instances.\n\n##### Methods\n\n- `schnorr_recover(msg, schnorr_sig, raw=False, digest=hashlib.sha256)` -\u003e internal object\u003cbr/\u003e\nrecover and return a public key from a Schnorr signature. `schnorr_sig` is expected to be the result from `schnorr_partial_combine` or `schnorr_sign`. `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.\n\n- `schnorr_partial_combine(schnorr_sigs)` -\u003e bytes\u003cbr/\u003e\ncombine multiple Schnorr partial signatures. `raw_sigs` is expected to be a list (or similar iterable) of signatures resulting from `PrivateKey.schnorr_partial_sign`. If the signatures cannot be combined, an Exception is raised.\n\n\u003e NOTE: `schnorr_*` can only be used if the `secp256k1` C library is compiled with support for it. If there is no support, an Exception will be raised when calling any of them.\n\n\n#### Constants\n\n##### `secp256k1.FLAG_SIGN`\n##### `secp256k1.FLAG_VERIFY`\n##### `secp256k1.ALL_FLAGS`\n\n`ALL_FLAGS` combines `FLAG_SIGN` and `FLAG_VERIFY` using bitwise OR.\n\nThese flags are used during context creation (undocumented here) and affect which parts of the context are initialized in the C library. In these bindings, some calls are disabled depending on the active flags but this should not be noticeable unless you are manually specifying flags.\n\n\n\n## Example\n\n```python\nfrom secp256k1 import PrivateKey, PublicKey\n\nprivkey = PrivateKey()\nprivkey_der = privkey.serialize()\nassert privkey.deserialize(privkey_der) == privkey.private_key\n\nsig = privkey.ecdsa_sign(b'hello')\nverified = privkey.pubkey.ecdsa_verify(b'hello', sig)\nassert verified\n\nsig_der = privkey.ecdsa_serialize(sig)\nsig2 = privkey.ecdsa_deserialize(sig_der)\nvrf2 = privkey.pubkey.ecdsa_verify(b'hello', sig2)\nassert vrf2\n\npubkey = privkey.pubkey\npub = pubkey.serialize()\n\npubkey2 = PublicKey(pub, raw=True)\nassert pubkey2.serialize() == pub\nassert pubkey2.ecdsa_verify(b'hello', sig)\n```\n\n```python\nfrom secp256k1 import PrivateKey\n\nkey = '31a84594060e103f5a63eb742bd46cf5f5900d8406e2726dedfc61c7cf43ebad'\nmsg = '9e5755ec2f328cc8635a55415d0e9a09c2b6f2c9b0343c945fbbfe08247a4cbe'\nsig = '30440220132382ca59240c2e14ee7ff61d90fc63276325f4cbe8169fc53ade4a407c2fc802204d86fbe3bde6975dd5a91fdc95ad6544dcdf0dab206f02224ce7e2b151bd82ab'\n\nprivkey = PrivateKey(bytes(bytearray.fromhex(key)), raw=True)\nsig_check = privkey.ecdsa_sign(bytes(bytearray.fromhex(msg)), raw=True)\nsig_ser = privkey.ecdsa_serialize(sig_check)\n\nassert sig_ser == bytes(bytearray.fromhex(sig))\n```\n\n```python\nfrom secp256k1 import PrivateKey\n\nkey = '7ccca75d019dbae79ac4266501578684ee64eeb3c9212105f7a3bdc0ddb0f27e'\npub_compressed = '03e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e9'\npub_uncompressed = '04e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e94c181c5fe89306493dd5677143a329065606740ee58b873e01642228a09ecf9d'\n\nprivkey = PrivateKey(bytes(bytearray.fromhex(key)))\npubkey_ser = privkey.pubkey.serialize()\npubkey_ser_uncompressed = privkey.pubkey.serialize(compressed=False)\n\nassert pubkey_ser == bytes(bytearray.fromhex(pub_compressed))\nassert pubkey_ser_uncompressed == bytes(bytearray.fromhex(pub_uncompressed))\n```\n\n\n## Technical details about the bundled libsecp256k1\n\nThe bundling of libsecp256k1 is handled by the various setup.py build phases:\n\n- During 'sdist':\n  If the directory `libsecp256k1` doesn't exist in the\n  source directory it is downloaded from the location specified\n  by the `LIB_TARBALL_URL` constant in `setup.py` and extracted into\n  a directory called `libsecp256k1`\n\n  To upgrade to a newer version of the bundled libsecp256k1 source\n  simply delete the `libsecp256k1` directory and update the\n  `LIB_TARBALL_URL` to point to a newer commit.\n\n- During 'install':\n  If an existing (system) installation of libsecp256k1 is found\n  (either in the default library locations or in the location pointed\n  to by the environment variable `LIB_DIR`) it is used as before.\n\n  Due to the way the way cffi modules are implemented it is necessary\n  to perform this detection in the cffi build module\n  `_cffi_build/build.py` as well as in `setup.py`. For that reason\n  some utility functions have been moved into a `setup_support.py`\n  module which is imported from both.\n\n  If however no existing installation can be found the bundled\n  source code is used to build a library locally that will be\n  statically linked into the CFFI extension.\n\n  By default only the `recovery` module will be enabled in this bundled\n  version as it is the only one not considered to be 'experimental' by\n  the libsecp256k1 authors. It is possible to override this and enable\n  all modules by setting the environment variable\n  `SECP_BUNDLED_EXPERIMENTAL`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhtitor%2Fsecp256k1prp-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhtitor%2Fsecp256k1prp-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhtitor%2Fsecp256k1prp-py/lists"}