lc6chang / ecc-pycrypto Goto Github PK
View Code? Open in Web Editor NEWA Python package for ECC and ElGamal elliptic curve encryption.
License: MIT License
A Python package for ECC and ElGamal elliptic curve encryption.
License: MIT License
I'm using your (awesome) library and I'd like to include it in a project. It would be so much easier if I could just pip install it.
Thank you!
When doubling a point on x axis (i.e. y=0), the expected result is the Point at infinity but now it raises 'modular inverse does not exist' exception.
>>> from ecc.curve import Curve25519
>>> from ecc.curve import Point
>>> P = Point(x=0, y=0, curve=Curve25519)
>>> P + P
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 40, in __add__
return self.curve.add_point(self, other)
File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 104, in add_point
return self._double_point(P)
File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 255, in _double_point
s = up * modinv(down, self.p)
File "/Users/chang/ecc-pycrypto/ecc/math_utils/mod_inverse.py", line 16, in modinv
raise Exception("modular inverse does not exist")
Exception: modular inverse does not exist
I have tried to check if this implementation can be used for Additive homomorphism available in ElGamal.
For example, to achieve sometime like this this
ADD(X,Y) = Enc(plain_text_1+plain_text_2)
where
X=(C1, C2)
Y=(C3, C4)
pri_key, pub_key = gen_keypair(Curve25519)
cipher_elg = ElGamal(Curve25519)
plain_text_1 = bytes([3])
plain_text_2 = bytes([4])
X=C1, C2 = cipher_elg.encrypt(plain_text_1, pub_key)
Y=C3, C4 = cipher_elg.encrypt(plain_text_2, pub_key)
C5 = Curve25519.add_point(C1,C3)
C6 = Curve25519.add_point(C2,C4)
result = cipher_elg.decrypt(pri_key, C5, C6)
Then the output is expected to be 7.
Seems cipher_elg.decrypt(pri_key, C5, C6)
will not work.
Maybe it can be done as future improvements.
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.