Python Generate Ecdsa Key Pair
Released:
A lightweight and fast pure python ECDSA library
C# Ecdsa
Project description
A lightweight and fast pure Python ECDSA
Overview
The public key, obtained by multiplying the private key by the curve generator point, consists of 2. 256 bits (uncompressed). The produced ECDSA digital signature verifies correctly after signing. If the message is tampered, the signature fails to verify. Public Key Recovery from the ECDSA Signature. SSH key-type, rsa, dsa, ecdsa, are there easy answers for which to choose when? Ask Question Asked 7 years, 5 months ago. Active 1 year. RSA is better known and you can generate longer keys with it (default is 2048 as opposed to DSA's 1024 bit fixed length), so it is (arguably) better to use. ECDSA keys could be better, but sadly, ECDSA. The following are code examples for showing how to use ecdsa.SigningKey.generate.They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. The second one mixed Python and C and it was really fast, but we were unable to use it in our current infrastructure, which required pure Python code. For this reason, we decided to create something simple, compatible with OpenSSL and fast using elegant math such as Jacobian Coordinates to speed up the ECDSA. Starkbank-ECDSA is fully compatible.
We tried other Python libraries such as python-ecdsa, fast-ecdsa and other less famous ones, but we didn't find anything that suited our needs. The first one was pure Python, but it was too slow. The second one mixed Python and C and it was really fast, but we were unable to use it in our current infrastructure, which required pure Python code.
For this reason, we decided to create something simple, compatible with OpenSSL and fast using elegant math such as Jacobian Coordinates to speed up the ECDSA. Starkbank-ECDSA is fully compatible with Python2 and Python3.
Installation
To install StarkBank`s ECDSA-Python, run:
Curves
We currently support secp256k1
, but it's super easy to add more curves to the project. Just add them on curve.py
Speed
We ran a test on a MAC Pro i7 2017. The libraries were run 100 times and the averages displayed bellow were obtained:
Library | sign | verify |
---|---|---|
python-ecdsa | 121.3ms | 65.1ms |
fast-ecdsa | 0.1ms | 0.2ms |
starkbank-ecdsa | 4.1ms | 7.8ms |
Our pure Python code cannot compete with C based libraries, but it's 6x faster
to verify and 23x faster
to sign than other pure Python libraries.
Sample Code
How to sign a json message for Stark Bank:
Simple use:
OpenSSL
This library is compatible with OpenSSL, so you can use it to generate keys:
Create a message.txt file and sign it:
To verify, do this:
You can also verify it on terminal:
NOTE: If you want to create a Digital Signature to use with Stark Bank, you need to convert the binary signature to base64.
You can do the same with this library:
Run unit tests
Release historyRelease notifications
1.0.0
0.1.9
0.1.8
0.1.7
0.1.6 Xsl generate-id key example.
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size starkbank-ecdsa-1.0.0.tar.gz (12.0 kB) | File type Source | Python version None | Upload date | Hashes |
Python Generate Ecdsa Key Pair Key
CloseHashes for starkbank-ecdsa-1.0.0.tar.gz
Ecdsa Key Generation
Algorithm | Hash digest |
---|---|
SHA256 | cd17ec9fa7ad8ae3fc81a63ddb7e0d7fb798a048e40c1a9c55afd1a207d1eff9 |
MD5 | 4607c0d9e07c205e97b059406619fdda |
BLAKE2-256 | 8c93f31f9b8989aab9db063d359b336eb80d83248b076107fc8d491b7de71e48 |