cryptofun/README.md
README.mdRaw
1# cryptofun [](https://goreportcard.com/report/github.com/arnaucube/cryptofun)
2
3Crypto algorithms from scratch. Academic purposes only.
4
5
6## RSA cryptosystem & Blind signature & Homomorphic Multiplication
7- https://en.wikipedia.org/wiki/RSA_(cryptosystem)#
8- https://en.wikipedia.org/wiki/Blind_signature
9- https://en.wikipedia.org/wiki/Homomorphic_encryption
10
11- [x] GenerateKeyPair
12- [x] Encrypt
13- [x] Decrypt
14- [x] Blind
15- [x] Blind Signature
16- [x] Unblind Signature- RSA- RSA
17- [x] Verify Signature
18- [x] Homomorphic Multiplication
19
20## Paillier cryptosystem & Homomorphic Addition
21- https://en.wikipedia.org/wiki/Paillier_cryptosystem
22- https://en.wikipedia.org/wiki/Homomorphic_encryption
23
24- [x] GenerateKeyPair
25- [x] Encrypt
26- [x] Decrypt
27- [x] Homomorphic Addition
28
29## Shamir Secret Sharing
30- https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing
31
32- [x] create secret sharing from number of secrets needed, number of shares, random point p, secret to share
33- [x] Lagrange Interpolation to restore the secret from the shares
34
35## Diffie-Hellman
36- https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
37
38- [x] key exchange
39
40## ECC
41- https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
42
43- [x] define elliptic curve
44- [x] get point at X
45- [x] get order of a Point on the elliptic curve
46- [x] Add two points on the elliptic curve
47- [x] Multiply a point n times on the elliptic curve
48
49## ECC ElGamal
50- https://en.wikipedia.org/wiki/ElGamal_encryption
51
52- [x] ECC ElGamal key generation
53- [x] ECC ElGamal Encrypton
54- [x] ECC ElGamal Decryption
55
56## ECC ECDSA
57- https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm
58
59- [x] define ECDSA data structure
60- [x] ECDSA Sign
61- [x] ECDSA Verify signature
62
63
64## Schnorr signature
65- https://en.wikipedia.org/wiki/Schnorr_signature
66
67- [x] Hash[M || R] (where M is the msg bytes and R is a Point on the ECC, using sha256 hash function)
68- [x] Generate Schnorr scheme
69- [x] Sign
70- [x] Verify signature
71
72
73## Bn128
74**[not finished]**
75
76This is implemented followng the implementations and info from:
77- https://github.com/iden3/zksnark
78- https://github.com/zcash/zcash/tree/master/src/snark
79- `Multiplication and Squaring on Pairing-Friendly
80Fields`, Augusto Jun Devegili, Colm Ó hÉigeartaigh, Michael Scott, and Ricardo Dahab https://pdfs.semanticscholar.org/3e01/de88d7428076b2547b60072088507d881bf1.pdf
81- `Optimal Pairings`, Frederik Vercauteren https://www.cosic.esat.kuleuven.be/bcrypt/optimal.pdf
82- `Double-and-Add with Relative Jacobian
83Coordinates`, Björn Fay https://eprint.iacr.org/2014/1014.pdf
84- `Fast and Regular Algorithms for Scalar Multiplication
85over Elliptic Curves`, Matthieu Rivain https://eprint.iacr.org/2011/338.pdf
86
87- [x] Fq, Fq2, Fq6, Fq12 operations
88- [x] G1, G2 operations
89
90---
91
92To run all tests:
93```
94go test ./... -v
95```