Skip to content
🎉 Welcome! Enjoy your reading, and I hope you will learn something new.
Cryptography

Cryptography

All there is to know about cryptography / cryptanalysis

Here you’ll find all my notes related to cryptography and cryptanalysis in the context of cybersecurity and CTF challenges. I will cover algorithms, crypto-systems, and, more importantly, attacks against them in many different scenarios.

Tools

Here are the more general tools I always use and recommend when starting to do things about cryptography :

ToolDescription
PythonGeneral-purpose programming language with extensive scientific and crypto libraries
└── gmpy2Fast multiple-precision arithmetic library for number theory
└── sympySymbolic mathematics library for algebra and calculus
└── cryptographySecure cryptographic primitives and recipes
└── pycryptodomeSelf-contained cryptographic library for Python
└── pwntoolsCTF and exploit development framework
└── z3-solverSMT solver for symbolic reasoning and constraint solving
└── SciPyScientific computing library for optimization and numerical methods
└── NumPyCore numerical computing library for arrays and linear algebra
SageMathOpen-source mathematics system for algebra, number theory, and cryptography
fplllLattice reduction algorithms using floating-point methods
Pari/GPFast computer algebra system for number theory computations
MagmaComputational algebra system for advanced mathematical research
flatterHigh-performance lattice reduction tool
msolveSolver for polynomial systems using algebraic methods

Online

ToolDescription
BoxentriqOnline cipher identifier and automated cryptanalysis helper
CyberChefWeb-based data analysis and encoding/decoding “Swiss Army knife”

Flake Environment

If you’re using the Nix package manager, here is a starter template that I currently use for crypto challenges during CTF competitions. It comes with all the tools mentioned above for a good out-of-the-box experience.

You can find other packages to install on the Nix package repository.

flake.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  description = "Crypto Environment";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            python313Packages.numpy
            python313Packages.galois
            python313Packages.scipy
            python313Packages.gmpy2
            python313Packages.pwntools
            python313Packages.sympy
            python313Packages.pycryptodome
            python313Packages.z3-solver
            python313Packages.cryptography
            python313Packages.cypari
            python313Packages.mpmath
            python313Packages.fpylll
            flatter
            msolve
            magma
            pari
            fplll
            sage
          ];
        };
      }
    );
}

Resources

Last updated on