Contents

List of Figures
List of Tables
Glossary
I  Introduction
1 Introduction
2 Cryptography Concepts and Terminology
 2.1 Security Concepts
 2.2 Cryptography Concepts
 2.3 Cryptography Notation and Terminology
II  Tools and Techniques
3 Software Tools
 3.1 Linux and Ubuntu
  3.1.1 Hex and Binary Viewer: xxd
  3.1.2 Arbitrary Precision Calculator: bc
  3.1.3 Random Numbers
  3.1.4 Hash Functions
  3.1.5 Bash Scripts
 3.2 OpenSSL
  3.2.1 Overview of OpenSSL
  3.2.2 Common Operations
  3.2.3 Listing Ciphers and Algorithms
  3.2.4 Random Number Generation with OpenSSL
 3.3 Python
  3.3.1 Cryptography Package
  3.3.2 PyCipher Package
4 Statistics for Communications and Security
 4.1 Binary Values
 4.2 Counting
 4.3 Permutations and Combinations
 4.4 Probability
 4.5 Collisions
5 Number Theory
 5.1 Divisibility and Primes
 5.2 Modular Arithmetic
 5.3 Fermat’s and Euler’s Theorems
 5.4 Discrete Logarithms
 5.5 Computationally Hard Problems
III  Symmetric Key Encryption
6 Classical Ciphers
 6.1 Caesar Cipher
  6.1.1 Caesar Cipher Definitions and Examples
  6.1.2 Brute Force Attack on Caesar Cipher
 6.2 Monoalphabetic Ciphers
  6.2.1 Monoalphabetic Cipher Definitions and Examples
  6.2.2 Brute Force Attack on Monoalphabetic Cipher
  6.2.3 Frequency Analysis Attack on Monoalphabetic Cipher
 6.3 Playfair Cipher
 6.4 Polyalphabetic Ciphers
 6.5 Vigenère Cipher
 6.6 Vernam Cipher
 6.7 One Time Pad
 6.8 Transposition Techniques
7 Encryption and Attacks
 7.1 Encryption Building Blocks
 7.2 Attacks on Encryption
  7.2.1 Aims and Knowledge of the Attacker
  7.2.2 Brute Force Attacks
  7.2.3 Cryptanalysis
  7.2.4 Measuring Security
 7.3 Block Cipher Design Principles
 7.4 Stream Cipher Design Principles
 7.5 Example: Brute Force on DES
 7.6 Example: Brute Force on AES
 7.7 Example: Meet-in-the-Middle Attack
 7.8 Example: Cryptanalysis on Triple-DES and AES
8 Data Encryption Standard
 8.1 Overview of the Data Encryption Standard (DES)
 8.2 Simplified-DES
 8.3 Details of DES
 8.4 DES in OpenSSL
  8.4.1 DES Encryption Basics in OpenSSL
  8.4.2 Symmetric Key Encryption Padding and Modes of Operation
  8.4.3 DES OpenSSL Exercises
 8.5 DES in Python
9 Advanced Encryption Standard
 9.1 Overview of AES
 9.2 Simplified-AES
 9.3 Simplified-AES Example
 9.4 AES in OpenSSL
  9.4.1 AES Encryption Basics in OpenSSL
  9.4.2 AES Performance Benchmarking
  9.4.3 AES OpenSSL Exercises
 9.5 AES in Python
10 Pseudorandom Number Generators
11 Block Cipher Modes of Operation
 11.1 Block Ciphers with Multiple Blocks
 11.2 Electronic Code Book
 11.3 Cipher Block Chaining Mode
 11.4 Cipher Feedback Mode
 11.5 Output Feedback Mode
 11.6 Counter Mode
 11.7 XTS-AES
IV  Public Key Cryptography
12 Public Key Cryptography
 12.1 Concepts of Public Key Cryptography
13 RSA
 13.1 RSA Algorithm
 13.2 Analysis of RSA
 13.3 Implementations of RSA
 13.4 RSA in OpenSSL
  13.4.1 RSA Key Generation in OpenSSL
  13.4.2 RSA Signing in OpenSSL (Sender)
  13.4.3 RSA Encryption in OpenSSL (Sender)
  13.4.4 RSA Decryption in OpenSSL (Receiver)
  13.4.5 RSA Verification in OpenSSL (Receiver)
  13.4.6 RSA OpenSSL Exercises
 13.5 RSA in Python
14 Diffie–Hellman Key Exchange
 14.1 Diffie–Hellman Key Exchange Algorithm
 14.2 Analysis of DHKE
 14.3 Man-in-the-Middle Attack on DHKE
 14.4 Implementations of DHKE
 14.5 Diffie–Hellman in OpenSSL
 14.6 DHKE in Python
15 Elliptic Curve Cryptography
 15.1 Overview of Elliptic Curve Cryptography
 15.2 Applications of Elliptic Curve Cryptography
 15.3 Elliptic Curve Cryptography in OpenSSL
V  Authentication
16 Hash Functions and MACs
 16.1 Informal Overview of Hashes and MACs
 16.2 Introduction to Hash Functions
 16.3 Properties of Cryptographic Hash Functions
 16.4 Introduction to Message Authentication Codes
17 Authentication and Data Integrity
 17.1 Aims of Authentication
 17.2 Authentication with Symmetric Key Encryption
 17.3 Authentication with Hash Functions
 17.4 Authentication with MACs
 17.5 Digital Signatures
VI  Key Management
18 Key Distribution and Management
 18.1 Recommended Key Sizes
19 Digital Certificates
VII  Advances in Cryptography
20 Quantum Computing and Cryptography
 20.1 Quantum Computing
 20.2 Quantum Algorithms
 20.3 Issues in Quantum Computing
 20.4 Quantum Cryptography
 20.5 Cryptography in the Quantum Era
VIII  Additional Resources
A Cryptography Assumptions and Principles
 A.1 Assumptions
  A.1.1 Encryption
  A.1.2 Knowledge of Attacker
  A.1.3 Authentication with Symmetric Key and MACs
  A.1.4 Hash Functions
  A.1.5 Digital Signatures
  A.1.6 Key Management and Random Numbers
 A.2 Principles
B Data Formats
 B.1 Common Data Formats
  B.1.1 English Alphabet
  B.1.2 Printable Keyboard Characters
  B.1.3 Binary Data
  B.1.4 ASCII
  B.1.5 Hexadecimal
  B.1.6 Base64
 B.2 Conversions using Linux
 B.3 Conversions using Python
C Organisations and People in Cryptography
 C.1 Organisations in Cryptography and Security
  C.1.1 National Institute of Standards and Technology
  C.1.2 International Association for Cryptologic Research
  C.1.3 Australian Signals Directorate
  C.1.4 National Security Agency
  C.1.5 Government Communications Headquarters
  C.1.6 Institute of Electrical and Electronics Engineers
  C.1.7 Internet Engineering Task Force
 C.2 People in Cryptography and Security
  C.2.1 Diffie, Hellman and Merkle
  C.2.2 Rivest, Shamir and Adleman
  C.2.3 Alan Turing
  C.2.4 Claude Shannon
  C.2.5 Hedy Lamarr
  C.2.6 Phil Zimmermann
  C.2.7 Other People
D Versions of this Book