You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.3 KiB

  1. # cryptofun [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/cryptofun)](https://goreportcard.com/report/github.com/arnaucube/cryptofun)
  2. Crypto algorithms from scratch. Academic purposes only.
  3. ## RSA
  4. https://en.wikipedia.org/wiki/RSA_(cryptosystem)#
  5. - [x] GenerateKeyPair
  6. - [x] Encrypt
  7. - [x] Decrypt
  8. - [x] Blind
  9. - [x] Blind Signature
  10. - [x] Unblind Signature
  11. - [x] Verify Signature
  12. - [x] Homomorphic Multiplication
  13. ## Paillier
  14. https://en.wikipedia.org/wiki/Paillier_cryptosystem
  15. - [x] GenerateKeyPair
  16. - [x] Encrypt
  17. - [x] Decrypt
  18. - [x] Homomorphic Addition
  19. ## Shamir Secret Sharing
  20. https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing
  21. - [x] create secret sharing from number of secrets needed, number of shares, random point p, secret to share
  22. - [x] Lagrange Interpolation to restore the secret from the shares
  23. ## Diffie-Hellman
  24. https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
  25. - [x] key exchange
  26. ## ECC
  27. https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
  28. - [x] define elliptic curve
  29. - [x] get point at X
  30. - [x] get order of a Point on the elliptic curve
  31. - [x] Add two points on the elliptic curve
  32. - [x] Multiply a point n times on the elliptic curve
  33. ## ECC ElGamal
  34. https://en.wikipedia.org/wiki/ElGamal_encryption
  35. - [x] ECC ElGamal key generation
  36. - [x] ECC ElGamal Encrypton
  37. - [x] ECC ElGamal Decryption
  38. ## ECC ECDSA
  39. https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm
  40. - [x] define ECDSA data structure
  41. - [x] ECDSA Sign
  42. - [x] ECDSA Verify signature
  43. ## Schnorr signature
  44. https://en.wikipedia.org/wiki/Schnorr_signature
  45. - [x] Hash[M || R] (where M is the msg bytes and R is a Point on the ECC, using sha256 hash function)
  46. - [x] Generate Schnorr scheme
  47. - [x] Sign
  48. - [x] Verify signature
  49. ## Bn128
  50. **[not finished]**
  51. This is implemented followng the implementations and info from:
  52. - https://github.com/iden3/zksnark
  53. - https://github.com/zcash/zcash/tree/master/src/snark
  54. - `Multiplication and Squaring on Pairing-Friendly
  55. Fields`, Augusto Jun Devegili, Colm Ó hÉigeartaigh, Michael Scott, and Ricardo Dahab https://pdfs.semanticscholar.org/3e01/de88d7428076b2547b60072088507d881bf1.pdf
  56. - `Optimal Pairings`, Frederik Vercauteren https://www.cosic.esat.kuleuven.be/bcrypt/optimal.pdf
  57. - [x] Fq, Fq2, Fq6, Fq12 operations
  58. ---
  59. To run all tests:
  60. ```
  61. go test ./... -v
  62. ```