Book Plan
A summary we plan to cover


The aim of CryptoBook is to have a consolidated space for all of the mathematics required to properly learn and enjoy cryptography. The focus of any topic should be to introduce a reader to a subject in a way that is fun, engaging and with an attempt to frame it as an applied resource.
The second focus should be to cleanly implement the various topics using SageMath, so that there is a clear resource for a new reader to gain insight on how SageMath might be used to create the objects needed.
Write about what you love and this book will be a success.
Descriptions of attacks against cryptosystems are strongly encouraged, however full SageMath implementations should not be included, as this has the potential for destroying CryptoHack challenges, or making all attacks known by so many people that CTFs become a total nightmare!!

Proposed topics

This list is not complete so please add to it as you see fit.

Mathematical Background


  • Congruences
  • GCD, LCM
    • Bézout's Theorem
    • Gauss' Lemma and its ten thousand corollaries
  • Euclid's algorithm
  • Modular Arithmetic
  • Morphisms et al.
  • Frobenius endomorphism

Number Theory

Mainly thinking things like
  • Prime decomposition and distribution
  • Primality testing
  • Euler's theorem
  • Factoring
  • Legendre / Jacobi symbol

Abstract Algebra

Mainly thinking things like:
  • Groups, Rings, Fields, etc.
  • Abelian groups and their relationship to key-exchange
  • Lagrange's theorem and small subgroup attacks

Basilar Cryptanalysis forms

  • Introduction to Cryptanalysis
  • A linear Approach to Cryptanalysis
  • Matsui's Best biases algorithm
  • A Differential Approach to Cryptanalysis

Elliptic Curves

Generating Elliptic Curves

Hyperelliptic curves

  • Generalization of elliptic curves
  • Recovering a group structure using the Jacobian
  • Example: genus one curves, jacobian is isomorphic to the set of points
  • Mumford representation of divisors
  • Computing the order of the Jacobian

Security background

  • Basic Concepts
    • Confidentiality, Integrity etc
    • Encryption, Key generation
  • Attacker goals + Attack games
  • Defining Security - Perfect security, semantic security
  • Proofs of security + Security Reductions

Asymmetric Cryptography


  • Textbook protocol
  • Padding
    • Bleichenbacher's Attack
    • OAEP
  • Coppersmith
    • Håstad's Attack
    • Franklin-Reiter Attack
  • Wiener's Attack
  • RSA's Integer fattorization Attacks
    • Fermat Factoring Attack
    • Quadratic Sieve Attack
    • Number Fielde Sieve Attack
  • RSA Digital Signature Scheme
  • Timing Attacks on RSA
  • RSA with Chinese Remainder Theorem (CRT)

Paillier Cryptosystem

  • Textbook protocol

ElGamal Encryption System

  • Textbook protocol
  • ElGamal Digital Signature Scheme


  • Textbook protocol
  • Strong primes, and why

Elliptic Curve Cryptography

  • EdDSA

Symmetric Cryptography

One Time Pad

  • XOR and its properties
  • XOR as One Time Pad
  • Generalized One Time Pad
Block Ciphers
  • AES
Stream Ciphers
  • Affine
  • RC4


  • Introduction
  • Trapdoor Functions
  • MD family
  • SHA family
  • BLAKE Hash family
  • // TODO: Insert Attacks

Isogeny Based Cryptography

  • Isogenies
  • Isogeny graphs
  • Torsion poins
  • SIDH
  • SIKE
  • BIKE

Cryptographic Protocols

Zero-knowledge proofs

  • Schnorr proof of knowledge for dlog
  • Core definitions
  • Proof of equality of dlog
  • Proof of knowledge of a group homomorphism preimage

Formal Verification of Security Protocols

  • Definition of Formal Verification
  • Uses of Formal Verification
  • Handshake protocols, flawed protocols
  • The external threat: Man-In-The-Middle attacks
  • Attacking the (flawed) Needham-Shroeder public key exchange protocol

Usefull Resources ( Books, articles ..) // based on my material

  • Cryptanalytic Attacks on RSA (Yan, Springer, 2008)
  • Algorithmic Cryptanalysis (Antoine Joux, CRC Press, 2009)
  • Algebraic Cryptanalysis (Brad, Springer, 2009)
  • RC4 stream Cipher and its variants (H. Rosen, CRC Press, 2013)
  • Formal Models and Techniques for Analyzing Security Protocols (Cortier, IOS Press, 2011)
  • Algebraic Shift Register Sequences (Goresky && Klapper, Cambridge Press, 2012)
  • The Modelling and Analysis of Security Protocols (Schneider, Pearson, 2000)
  • Secure Transaction Protocol Analysis (Zhang && Chen, Springer, 2008)