secp256k1 | Optimized C library for EC operations on curve secp256k1 | Cryptography library

 by   bitcoin-core C Version: v0.3.2 License: MIT

kandi X-RAY | secp256k1 Summary

kandi X-RAY | secp256k1 Summary

secp256k1 is a C library typically used in Security, Cryptography, Bitcoin applications. secp256k1 has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1. This library is intended to be the highest quality publicly available library for cryptography on the secp256k1 curve. However, the primary focus of its development has been for usage in the Bitcoin system and usage unlike Bitcoin’s may be less well tested, verified, or suffer from a less well thought out interface. Correct usage requires some care and consideration that the library is fit for your application’s purpose. Features: * secp256k1 ECDSA signing/verification and key generation. * Additive and multiplicative tweaking of secret/public keys. * Serialization/parsing of secret keys, public keys, signatures. * Constant time, constant memory access signing and public key generation. * Derandomized ECDSA (via RFC6979 or with a caller provided function.) * Very efficient implementation. * Suitable for embedded systems. * Optional module for public key recovery. * Optional module for ECDH key exchange. Experimental features have not received enough scrutiny to satisfy the standard of quality of this library but are made available for testing and review by the community. The APIs of these features should not be considered stable.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              secp256k1 has a medium active ecosystem.
              It has 1765 star(s) with 948 fork(s). There are 115 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 93 open issues and 311 have been closed. On average issues are closed in 358 days. There are 48 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of secp256k1 is v0.3.2

            kandi-Quality Quality

              secp256k1 has 0 bugs and 0 code smells.

            kandi-Security Security

              secp256k1 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              secp256k1 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              secp256k1 is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              secp256k1 releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of secp256k1
            Get all kandi verified functions for this library.

            secp256k1 Key Features

            No Key Features are available at this moment for secp256k1.

            secp256k1 Examples and Code Snippets

            ECDSA Sign / Verify using the secp256k1 Curve and SHA3-256
            Pythondot img1Lines of Code : 46dot img1no licencesLicense : No License
            copy iconCopy
            from pycoin.ecdsa import generator_secp256k1, sign, verify
            import hashlib, secrets
            
            def sha3_256Hash(msg):
                hashBytes = hashlib.sha3_256(msg.encode("utf8")).digest()
                return int.from_bytes(hashBytes, byteorder="big")
            
            def signECDSAsecp256k1(msg  

            Community Discussions

            QUESTION

            Getting a error when installing TRUFFLE on windows
            Asked 2022-Mar-29 at 00:40

            I have tried installing truffle on windows powershell with Execution Policy set to "ByPass".

            And installing a older version but noting has worked any help is appreciated.

            I have node v16.13.0. And have not had any problems before with installing packages.

            As well I have the latest version of Virtual studio code.

            ...

            ANSWER

            Answered 2022-Mar-28 at 07:00

            Hello did u try npm install --g --production windows-build-tools

            Similar problem -> node-gyp configure got "gyp ERR! find VS"

            Lot of ppl had similiar issue and this command helped

            If nothing will help i can recommend u https://remix.ethereum.org/ its online IDE that simulate everything. (I have good experience with it on Ether and solidity)

            Source https://stackoverflow.com/questions/71641085

            QUESTION

            SSLHandshakeException only when using RestTemplate
            Asked 2022-Feb-28 at 18:33

            I'm using Java 8, trying to post https third party (other subdomain works), works with postman, but using RestTemplate throws SSLHandshakeException

            ...

            ANSWER

            Answered 2022-Feb-28 at 18:33

            Please, be aware that the cipher suites described in your debug output doesn't show the cipher suite that was actually used by openssl, ECDHE-RSA-AES256-GCM-SHA384. In fact, they don't include any cipher suite that requires AES 256. It may not be of relevance, but it may be a symptom of any misconfiguration, and can explain why the handshake is failing. As indicated in the Oracle documentation when describing Java 8 supported cipher suites:

            Cipher suites that use AES_256 require installation of the JCE Unlimited Strength Jurisdiction Policy Files.

            As a consequence, please, be sure you installed and properly configured the JCE Unlimited Strength Jurisdiction Policy Files.

            As indicated by @dave_thompson_085 in his excellent comment, only Oracle Java 8 below 8u161 requires adding the unlimited policy, as stated in Appendix C of the aforementioned Oracle documentation.

            The JCE Unlimited Strength Jurisdiction Policy Files are bundled into the JDK since JDK 8u151, but the unlimited policy was not defined as the default one since JDK 8u161.

            In JDK 8u151 or 8u152, as stated in one of the previous cited links, and explained as well by @dave_thompson_085 - thank you very much again, in order to make the unlimited version of the JCE the one that should be used, you need to define the system property crypto.policy. From the docs:

            This release introduces a new feature whereby the JCE jurisdiction policy files used by the JDK can be controlled via a new Security property. In older releases, JCE jurisdiction files had to be downloaded and installed separately to allow unlimited cryptography to be used by the JDK. The download and install steps are no longer necessary. To enable unlimited cryptography, one can use the new crypto.policy Security property. If the new Security property (crypto.policy) is set in the java.security file, or has been set dynamically by using the Security.setProperty() call before the JCE framework has been initialized, that setting will be honored. By default, the property will be undefined. If the property is undefined and the legacy JCE jurisdiction files don't exist in the legacy lib/security directory, then the default cryptographic level will remain at 'limited'. To configure the JDK to use unlimited cryptography, set the crypto.policy to a value of 'unlimited'. See the notes in the java.security file shipping with this release for more information.

            The issue is not present in OpenJDK.

            As an alternative solution, as suggested in this related SO question, probably using an alternate provider like BouncyCastle could be of help as well.

            Source https://stackoverflow.com/questions/71222498

            QUESTION

            how to sign a message with ecdsa privatekey using golang?
            Asked 2022-Feb-20 at 14:48

            I am trying to sign a message in go generated via hd wallet's private key using cosmos sdk. Below is the equivalent implementation in python which generates the signed message / signature as expected when submitted/verified is working properly but unable to get it working wtih Go implementation. Any inputs for equivalent golang version of the python implementation is much appreciated. Thank you.

            Python version uses sha256 , ecdsa but when using the equivalent cyrpto/ecdsa doesn't return valid signature.

            Python

            ...

            ANSWER

            Answered 2022-Feb-20 at 14:48

            Both codes return hex encoded as private key

            Source https://stackoverflow.com/questions/71186925

            QUESTION

            How to generate hd wallet keys & addresses given seed phrase with cosmos sdk?
            Asked 2022-Feb-13 at 16:24

            I am trying to generate hd wallet private keys , public keys and addresess using cosmos sdk. Below is the equivalent implementation in python which generates the keys , address as expected but when trying to generated in golang using cosmos sdk it won't generate same keys. Any inputs for equivalent golang version of the python implementation is much appreciated. Thank you.

            Python

            ...

            ANSWER

            Answered 2022-Feb-13 at 16:24

            The results of both codes differ because of two issues:

            • In the Go Code, the private key is derived incorrectly:

              In the Python code, the path m/44'/118'/0'/0/0' is used, as the output of hdwallet.path() shows. In the Go code, in contrast, the path m/44'/118'/0'/0/0 is used, as shown by the output of path.String().

              To use the path of the Python code in the Go code, the path can be e.g. specified directly. For this the line:

            Source https://stackoverflow.com/questions/70981681

            QUESTION

            Jest + Typescript Unable to Import Library (tiny-secp256k1)
            Asked 2022-Feb-10 at 18:07

            I am currently using the npm package tiny-secp256k1.

            It provides non-default exports of many functions (with type declaration).

            No matter how I try to import it, running my test suite. Jest throws:

            ...

            ANSWER

            Answered 2022-Feb-10 at 18:07

            I was struggling with this for a while too. I found out that it is some weird issue with jest and the "cjs" modules. Don't know exactly why it's like this but after some research I found this post (Jest won't transform the module - SyntaxError: Cannot use import statement outside a module) that gave me a clue of what I needed to do. Below is my jest.config.js file that solves this issue:

            Source https://stackoverflow.com/questions/70283652

            QUESTION

            Dogecoin Address generation - Address not valid
            Asked 2022-Feb-03 at 22:08

            I'm trying to generate Dogecoin addresses. The generated addresses have the same length as valid Dogecoin addresses generated by RPC-API getnewaddress and the same length, but they do not work. They are not valid.

            Here are the steps:

            1. Public key from secp256k1
            2. Apply SHA256, then RIPEMD-160 to the result of SHA256
            3. Add 0x1E (Version for Dogecoin) at the begin of the RIPEMD-160 result
            4. Apply SHA256 twice to the encrypted pubkey for the checksum hash
            5. Add first 4 bytes of the checksum hash (8 characters) to the end of the encrypted pub key
            6. Apply BASE56

            That generates a 34 characters address starting with D which looks very authentic, but none of them is valid. Why?

            ...

            ANSWER

            Answered 2022-Feb-03 at 22:08

            It turned out there was a byte missing.

            Source https://stackoverflow.com/questions/70965391

            QUESTION

            How to fix LevelDB library load error when running RSKj node on a Windows machine?
            Asked 2022-Jan-06 at 09:47

            I am trying to run RSK blockchain node RSKj on a Windows machine. When I run this line in a terminal:

            ...

            ANSWER

            Answered 2021-Oct-06 at 02:26

            This is actually a warning, not an error, though it may seem like the latter. This means that on your OS and architecture, that particular library does not exist, so it falls back to a different implementation (using a non-native library). In this case, the block verification is slower, but otherwise RSKj should continue to function properly.

            Something that might help you to overcome the “slowness” of the initial sync is the --import flag. See the reference in the CLI docs for RSKj.

            Also you can send an RPC to ensure that your node is running OK. Run the following curl command in your terminal

            Source https://stackoverflow.com/questions/69454759

            QUESTION

            Install node canvas on dockerized linux with M1
            Asked 2021-Dec-29 at 18:25

            I have following Dockerfile which I run on my MacBook Air M1 (so inside docker I have linux with M1)

            ...

            ANSWER

            Answered 2021-Dec-29 at 18:25

            Change your dockerfile to (it base on this info) following and install/run metaplex/canvas again

            Source https://stackoverflow.com/questions/70506840

            QUESTION

            Why are signatures created with ecdsa Python library not valid with coincurve?
            Asked 2021-Dec-25 at 14:41

            I'm switching from the pure Python ecdsa library to the much faster coincurve library for signing data. I would also like to switch to coincurve for verifying the signatures (including the old signatures created by the ecdsa library).

            It appears that signatures created with ecdsa are not (always?) valid in coincurve. Could someone please explain why this is not working? Also, it seems that cryptography library is able to validate both ecdsa signatures and coincurve signatures without issues, consistently.

            What is even more confusing, if you run below script a few times, is that sometimes it prints point 3 and other times it does not. Why would coincurve only occasionally find the signature valid?

            ...

            ANSWER

            Answered 2021-Dec-25 at 14:41

            Bitcoin and the coincurve library use canonical signatures while this is not true for the ecdsa library.

            What does canonical signature mean?
            In general, if (r,s) is a valid signature, then (r,s') := (r,-s mod n) is also a valid signature (n is the order of the base point).
            A canonical signature uses the value s' = -s mod n = n - s instead of s, i.e. the signature (r, n-s), if s > n/2, s. e.g. here.

            All signatures from the ecdsa library that were not been successfully validated by the coincurve library in your test program have an s > n/2 and thus are not canonical, whereas those that were successfully validated are canonical.

            So the fix is simply to canonize the signature of the ecdsa library, e.g.:

            Source https://stackoverflow.com/questions/70477905

            QUESTION

            crypto.generateKeyPairSync('ed25519') does not verify simple test, which an 'ec' keypair verifies without issue. What is the mistake?
            Asked 2021-Dec-19 at 09:37

            Been playing around with the crypto module in Nodejs and using crypto.generateKeyPairSync. When running a short verification test with 'ec' keys, this evaluates as expected, but when testing with 'ed25519' generated keys, this never evaluates to true.

            ...

            ANSWER

            Answered 2021-Dec-19 at 09:37

            NodeJS provides two implementations for signing/verifying, the Sign/Verify class (since v0.1.92) and crypto.sign()/crypto.verify() (since v12.0.0).

            Signing and verifying with Ed25519 (and Ed448) is possible with crypto.sign() and crypto.verify():

            Source https://stackoverflow.com/questions/70408080

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install secp256k1

            libsecp256k1 is built using autotools:. This library aims to have full coverage of the reachable lines and branches.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/bitcoin-core/secp256k1.git

          • CLI

            gh repo clone bitcoin-core/secp256k1

          • sshUrl

            git@github.com:bitcoin-core/secp256k1.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Cryptography Libraries

            dogecoin

            by dogecoin

            tink

            by google

            crypto-js

            by brix

            Ciphey

            by Ciphey

            libsodium

            by jedisct1

            Try Top Libraries by bitcoin-core

            gui

            by bitcoin-coreC++

            bitcoincore.org

            by bitcoin-coreHTML

            HWI

            by bitcoin-corePython

            btcdeb

            by bitcoin-coreC++

            gitian.sigs

            by bitcoin-corePython