learn-cryptography icon indicating copy to clipboard operation
learn-cryptography copied to clipboard

A collection of cryptographic techniques explained simply and implemented from scratch in Python or Rust

Learn Cryptography and ZK - cryptography and zero-knowledge proofs from scratch

Overview

A collection of cryptographic and zero-knowledge algorithms implemented from scratch in Python and Rust.

Implementations

Rust

This focuses mainly on implementations from Proofs, Arguments and Zero Knowledge (By Justin Thaler).

  • Finite Field
  • Univariate Polynomial
  • Shamir Secret Sharing

Python

This focuses mainly on traditional cryptography with a bit of blockchain cryptography

Ancient Cryptography

  • Ceasar Cipher
  • Simple Substitution Cipher
  • Polyalphabetic Cipher

19th Century Cryptography

  • One Time Pad
  • XOR + One Time Pad

Modern Cryptography

  • Hash-based Message Authentication Code (HMAC)
  • Diffie Hallman Key Exchange
  • RSA
  • Secure Hashing Algorithm 1 (SHA-1)
  • Secure Hashing Algorithm 2 224 (SHA2-224)
  • Secure Hashing Algorithm 2 256 (SHA2-256)
  • Secure Hashing Algorithm 2 384 (SHA2-384)
  • Secure Hashing Algorithm 2 512 (SHA2-512)
  • Secure Hashing Algorithm 3 224 (SHA3-224)
  • Secure Hashing Algorithm 3 256 (SHA3-256)
  • Secure Hashing Algorithm 3 384 (SHA3-384)
  • Secure Hashing Algorithm 3 512 (SHA3-512)
  • Elliptic Curve Diffie-Hellman (ECDH)
  • Elliptic Curve Digital Signature Algorithm (ECDSA)
  • Pedersen Commitments using Modular Exponentiation
  • Pedersen Commitments using Elliptic Curve Cryptography
  • Basic Polynomial Commitment using Modular Exponentiation
  • Basic Polynomial Commitment using Elliptic Curve Cryptography
  • Basic Trusted Setup using Modular Exponentiation
  • Basic Trusted Setup using Elliptic Curve Cryptography

Utils

  • Number Theory
  • Finite Field
  • Naive Elliptic Curve
  • Bandersnatch Curve
  • Bandersnatch Field

Usage

This serves as a learning material for me in my journey to becoming proficient at cryptography. I hope it helps you learn as well.

Disclamer

You probably know this, but please DO NOT USE IN PRODUCTION.