Elliptic-Curve Cryptography Library (Implemented by Python)
y^2 = x^3 + ax + b
over Field K
(char(K) != 2, 3
).x^2 + 1
or x^2 + x + 1
)example/id_based_encryption.py
: Implementation of Boneh-Franklin's Identity-based Encryption Schemeexample/boneh_lynn_shacham_short_signature.py
: Implementation of Boneh-Lynn-Shacham's Short Signature Schemeexample/ecdsa.py
: Implementation of ECDSA Signature Scheme> git clone https://github.com/elliptic-shiho/ecpy && cd ecpy
> pip install --upgrade .
If installed following modules, ecpy
uses that.
gmpy2
primefac
or primefac-forkecpy
has a native module. If you want to speed-up ecpy, you can use that.
> cd ecpy/cpp
> make
> sudo make install
The description is here: cpp/README.md
See bench_pairing.py
.
Sat Jan 28 03:55:47 JST 2017 ~/prog/lab/mathematics/ecpy 100%
> time python scripts/bench_pairing.py
[+] found gmpy! use gmpy.is_prime
[+] Found native module!
Point (25 : 5635866983L + 11271733966Lw : 1) on Elliptic Curve y^2 = x^3 + 1 over ExtendedFiniteField(13208557577, "x^2+x+1")
[+] Weil Pairing:
weil: 14744.50 usec/pass
weil: 14842.80 usec/pass
weil: 14626.05 usec/pass
weil: 14773.50 usec/pass
weil: 14582.25 usec/pass
weil: 14560.95 usec/pass
weil: 14622.40 usec/pass
weil: 15073.19 usec/pass
weil: 14874.60 usec/pass
weil: 14695.20 usec/pass
[+] Tate Pairing:
tate: 3079.89 usec/pass
tate: 3083.21 usec/pass
tate: 3079.10 usec/pass
tate: 3072.70 usec/pass
tate: 3069.81 usec/pass
tate: 3089.30 usec/pass
tate: 3077.90 usec/pass
tate: 3116.00 usec/pass
tate: 3095.35 usec/pass
tate: 3193.65 usec/pass
================================================================
weil: 14739.54 usec/pass
tate: 3095.69 usec/pass
real 0m4.293s
user 0m4.256s
sys 0m0.012s
Cybozu Labs Youth (5th, 6th) - http://labs.cybozu.co.jp/youth.html
This software released under MIT License. Please see /LICENSE.