onedgelee / simple-py-crypto Goto Github PK
View Code? Open in Web Editor NEWSimple toy implementation of crypto written in python
Simple toy implementation of crypto written in python
keygen_public
does not check validity of private_key
.
It's opened to users, so crucial error can be arised.
With error statement, have to prevent invalid private_key
.
There are just one sample test code, and need to be added for each methods.
Path on import statements are written with package path,
But current Pytest
workflow does not have package installing process.
This makes test workflow always fails.
Package installing on workflow is needed.
For now, generation code for private key(d) and public key(Q) exists (Though public key generation is imperfect), Implementation for signature(r, s) generation is needed.
To use ECDSA properly, signature validation is needed
There may be situations where you have to compute y coordinate with given elliptic curve with finite field modulus and x coordinate.
For example, when if elliptic curve domain parameter G
starts with 02
or 03
, y coordinate of its generator point is missing.
This can be done by Tonelli-Shanks algorithm, but I didn't implemented it for now.
It's not so crucial for now since we can easily get y coordinate information of secp256k1
from internet, parsing elliptic curve domain parameter G
starts with 04
, but for future, it have to be implemented.
SHA-256 is needed for hashing messages on ECDSA
Also, It's commonly used hashing algorithm,(for Bitcoin, double SHA-256 is standard) so it need to be implemented.
Current method for elliptic curve multiplication is done by iteration with elliptic curve point adding.
Since modulo p
= 115792089237316195423570985008687907853269984665640564039457584007908834671663, private key d
can be up to almost 10^77 (since 1 <= d <= p-1
)
Multiplier is same as k on ECDSA, so it means iteration number can be up to almost 10^77.
There can be two kind of approach to resolve it.
Black
workflow works with --check option.
That's because default black_args
are . --check --diff
.
Black
is powerful tool for automatic code fixing though, for linting, Pylint
is better I think.
So, I decided to use Black as automatic code fixing tool, and use Pylint
as a final checker.
--check
option is not needed, and have to be removed.
For convenience, single method for key pair generation is needed
And it may have optional private key for private key generation from outside.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.