Crypto From Scratch: Intro

This will be a first of many posts on creating Crypto Primitives from Scratch.

The code will have:

  • Tested against production implementations
  • Commented to give information about more complex instructions
  • Have common name variables and function names to give a better view of data flow
  • Be done in python since it is easy to read.

Crypto From Scratch Series

For a list of all of these implementations look at my https://github.com/GeneralZero/ChaCha-and-Salsa where I will be posting finished versions of common Encryption, Decryption, Hashing, Key Generation and Key Enchanges. Also this page will be update with new Algorithums.

Symetric Encryption

  • DES/3DES Symetric Encryption
  • ChaCha/XChaCha Symetric Encryption
  • Salsa/XSalsa Symetric Encryption
  • AES Symetric Encryption
  • RC4 Symetric Encryption
  • TEA Symetric Encryption (TODO)

Asymetric Encryption

  • RSA Asymetric Encryption
  • RSA PKCS#1 v1.5 Asymetric Encryption
  • RSA PKCS#1 OAEP Asymetric Encryption
  • ElGamal Asymetric Encryption
  • ECC Asymetric Encryption (TODO)

Message Authentication Codes

  • HMAC Message Authentication Code
  • Poly1305 Message Authentication Code
  • CMAC Message Authentication Code
  • GMAC Message Authentication Code
  • KMAC (TODO)
  • OMAC (TODO)

Hash Functions

  • MD2 Hash Function
  • MD4 Hash Function
  • MD5 Hash Function
  • SHA1 Hash Function
  • SHA2 (SHA224, SHA256, SHA384, SHA512) Hash Function
  • SHA3 (SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE-128, SHAKE-256, Keccak-224, Keccak-256, Keccak-384, Keccak-512) Hash Function
  • Blake (Blake224, Blake256, Blake384, Blake512) Hash Function
  • Blake2 (Blake2b, Blake2s) Hash Function
  • Gimli Hash Function

Key Exchange

  • Diffie Hellman Key Exchange
  • ECDH Key Exchange
  • Extended Triple Diffie-Hellman Key Exchange

Signature Generation

  • DSA
  • ECDSA
  • EdDSA
  • RSA
  • DKIM (TODO)

Key Derivation

  • PBKDF1 Key Derivation
  • PBKDF2 Key Derivation
  • Argon2 Key Derivation
  • BCrypt Key Derivation
  • Double Rachet Key Derivation (TODO)
  • Scrypt Key Derivation
  • Shamir’s Secret Sharing Scheme Key Derivation (TODO)