cryptofun 
Crypto algorithms from scratch. Academic purposes only.
RSA cryptosystem & Blind signature & Homomorphic Multiplication
-
GenerateKeyPair
-
Encrypt
-
Decrypt
-
Blind
-
Blind Signature
-
Unblind Signature- RSA- RSA
-
Verify Signature
-
Homomorphic Multiplication
Paillier cryptosystem & Homomorphic Addition
-
GenerateKeyPair
-
Encrypt
-
Decrypt
-
Homomorphic Addition
Shamir Secret Sharing
-
create secret sharing from number of secrets needed, number of shares, random point p, secret to share
-
Lagrange Interpolation to restore the secret from the shares
Diffie-Hellman
ECC
-
define elliptic curve
-
get point at X
-
get order of a Point on the elliptic curve
-
Add two points on the elliptic curve
-
Multiply a point n times on the elliptic curve
ECC ElGamal
-
ECC ElGamal key generation
-
ECC ElGamal Encrypton
-
ECC ElGamal Decryption
ECC ECDSA
-
https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm
-
define ECDSA data structure
-
ECDSA Sign
-
ECDSA Verify signature
Schnorr signature
-
Hash[M || R] (where M is the msg bytes and R is a Point on the ECC, using sha256 hash function)
-
Generate Schnorr scheme
-
Sign
-
Verify signature
Bn128
[not finished]
This is implemented followng the implementations and info from:
-
Multiplication and Squaring on Pairing-Friendly Fields, Augusto Jun Devegili, Colm Ó hÉigeartaigh, Michael Scott, and Ricardo Dahab https://pdfs.semanticscholar.org/3e01/de88d7428076b2547b60072088507d881bf1.pdf -
Optimal Pairings, Frederik Vercauteren https://www.cosic.esat.kuleuven.be/bcrypt/optimal.pdf -
Double-and-Add with Relative Jacobian Coordinates, Björn Fay https://eprint.iacr.org/2014/1014.pdf -
Fast and Regular Algorithms for Scalar Multiplication over Elliptic Curves, Matthieu Rivain https://eprint.iacr.org/2011/338.pdf -
Fq, Fq2, Fq6, Fq12 operations
-
G1, G2 operations
To run all tests:
go test ./... -v