07.07.2023 Views

Implementing-cryptography-using-python

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Contents xiii

Cryptographic One-Way Hashes 59

Message Authentication Codes 60

Perfect Forward Secrecy 60

Published and Proprietary Encryption Algorithms 61

Summary62

References62

Chapter 3 Classical Cryptography 65

Password Best Practices 66

Password Storage 66

Hashing Passwords 67

Salting Passwords 67

Stretching Passwords 68

Password Tools 68

Obfuscating Data 69

ASCII Encoding 70

Base64 Encoding Text 70

Binary Data 72

Decoding72

Historical Ciphers 72

Scytale of Sparta 73

Substitution Ciphers 73

Caesar Cipher 74

ROT-1376

Atbash Cipher 77

Vigenère Cipher 77

Playfair79

Hill 2x2 83

Column Transposition 87

Affine Cipher 90

Summary93

Chapter 4 Cryptographic Math and Frequency Analysis 95

Modular Arithmetic and the Greatest Common Devisor 96

Prime Numbers 97

Prime Number Theorem 98

School Primality Test 98

Fermat’s Little Theorem 100

Miller-Rabin Primality Test 100

Generate Large Prime Numbers 104

Basic Group Theory 106

Orders of Elements 107

Modular Inverses 109

Fermat’s Little Theorem to Find the Inverse 110

Extending the GCD 111

Euler’s Theorem 111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!