| Introduction |
|
xvii | |
|
Chapter 1 Introduction to Cryptography and Python |
|
|
1 | (30) |
|
|
|
2 | (1) |
|
|
|
2 | (1) |
|
Downloading and Installing Python |
|
|
3 | (6) |
|
|
|
4 | (1) |
|
|
|
4 | (1) |
|
|
|
4 | (1) |
|
Installing on a Chromebook |
|
|
4 | (1) |
|
Installing Additional Packages |
|
|
5 | (1) |
|
Installing Pip, NumPy, and Matplotlib |
|
|
6 | (1) |
|
Installing the Cryptography Package |
|
|
7 | (1) |
|
Installing Additional Packages |
|
|
8 | (1) |
|
|
|
9 | (1) |
|
Diving into Python Basics |
|
|
9 | (20) |
|
|
|
10 | (1) |
|
|
|
11 | (1) |
|
|
|
11 | (1) |
|
Understanding Arithmetic Operators |
|
|
11 | (2) |
|
Understanding Comparison Operators |
|
|
13 | (1) |
|
Understanding Logical Operators |
|
|
13 | (1) |
|
Understanding Assignment Operators |
|
|
14 | (1) |
|
Understanding Bitwise Operators |
|
|
15 | (1) |
|
Understanding Membership Operators |
|
|
15 | (1) |
|
Understanding Identity Operators |
|
|
16 | (1) |
|
|
|
16 | (1) |
|
|
|
17 | (1) |
|
|
|
17 | (1) |
|
|
|
18 | (1) |
|
|
|
18 | (1) |
|
|
|
18 | (1) |
|
|
|
18 | (1) |
|
|
|
19 | (1) |
|
Understanding Python Semantics |
|
|
20 | (1) |
|
|
|
20 | (6) |
|
Introducing Custom Functions |
|
|
26 | (1) |
|
Downloading Files Using Python |
|
|
27 | (1) |
|
Introducing Python Modules |
|
|
28 | (1) |
|
Creating a Reverse Cipher |
|
|
29 | (1) |
|
|
|
30 | (1) |
|
Chapter 2 Cryptographic Protocols and Perfect Secrecy |
|
|
31 | (34) |
|
|
|
32 | (17) |
|
Understanding Cryptography |
|
|
32 | (1) |
|
Cryptography's Famous Family: Alice and Bob |
|
|
33 | (1) |
|
|
|
34 | (1) |
|
Data Origin Authentication |
|
|
34 | (1) |
|
|
|
35 | (1) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
The Needham-Schroeder Protocols |
|
|
36 | (2) |
|
|
|
38 | (1) |
|
|
|
39 | (1) |
|
|
|
40 | (1) |
|
|
|
41 | (5) |
|
Formal Validation of Cryptographic Protocols |
|
|
46 | (1) |
|
Configuring Your First Cryptographic Library |
|
|
47 | (1) |
|
Understanding Cryptanalysis |
|
|
47 | (1) |
|
|
|
47 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
49 | (1) |
|
|
|
50 | (1) |
|
|
|
51 | (7) |
|
|
|
51 | (5) |
|
|
|
56 | (2) |
|
|
|
58 | (2) |
|
Cryptographic One-Way Hashes |
|
|
59 | (1) |
|
Message Authentication Codes |
|
|
60 | (1) |
|
|
|
60 | (1) |
|
Published and Proprietary Encryption Algorithms |
|
|
61 | (1) |
|
|
|
62 | (1) |
|
|
|
62 | (3) |
|
Chapter 3 Classical Cryptography |
|
|
65 | (30) |
|
|
|
66 | (3) |
|
|
|
66 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
68 | (1) |
|
|
|
68 | (1) |
|
|
|
69 | (3) |
|
|
|
70 | (1) |
|
|
|
70 | (2) |
|
|
|
72 | (1) |
|
|
|
72 | (1) |
|
|
|
72 | (21) |
|
|
|
73 | (1) |
|
|
|
73 | (1) |
|
|
|
74 | (2) |
|
|
|
76 | (1) |
|
|
|
77 | (1) |
|
|
|
77 | (2) |
|
|
|
79 | (4) |
|
|
|
83 | (4) |
|
|
|
87 | (3) |
|
|
|
90 | (3) |
|
|
|
93 | (2) |
|
Chapter 4 Cryptographic Math and Frequency Analysis |
|
|
95 | (44) |
|
Modular Arithmetic and the Greatest Common Devisor |
|
|
96 | (1) |
|
|
|
97 | (9) |
|
|
|
98 | (1) |
|
|
|
98 | (2) |
|
|
|
100 | (1) |
|
Miller-Rabin Primality Test |
|
|
100 | (4) |
|
Generate Large Prime Numbers |
|
|
104 | (2) |
|
|
|
106 | (3) |
|
|
|
107 | (2) |
|
|
|
109 | (2) |
|
Fermat's Little Theorem to Find the Inverse |
|
|
110 | (1) |
|
|
|
111 | (1) |
|
|
|
111 | (4) |
|
|
|
115 | (2) |
|
Breaking C's rand() Function |
|
|
116 | (1) |
|
Solving Systems of Linear Equations |
|
|
117 | (3) |
|
|
|
120 | (3) |
|
Cryptanalysis with Python |
|
|
123 | (15) |
|
Using an Online Word List |
|
|
125 | (1) |
|
Determining the Frequency |
|
|
126 | (3) |
|
Breaking the Vigenere Cipher |
|
|
129 | (9) |
|
|
|
138 | (1) |
|
Chapter 5 Stream Ciphers and Block Ciphers |
|
|
139 | (32) |
|
Convert between Hexdigest and Plaintext |
|
|
140 | (1) |
|
|
|
141 | (15) |
|
|
|
147 | (1) |
|
|
|
148 | (1) |
|
|
|
149 | (2) |
|
|
|
151 | (5) |
|
|
|
156 | (11) |
|
Block Modes of Operations |
|
|
158 | (1) |
|
|
|
158 | (1) |
|
|
|
159 | (1) |
|
|
|
160 | (2) |
|
|
|
162 | (1) |
|
|
|
163 | (1) |
|
|
|
164 | (1) |
|
DIY Block Cipher Using Feistel Networks |
|
|
165 | (2) |
|
Advanced Encryption Standard (AES) |
|
|
167 | (2) |
|
|
|
167 | (2) |
|
File Encryption Using AES |
|
|
169 | (1) |
|
File Decryption Using AES |
|
|
169 | (1) |
|
|
|
169 | (2) |
|
Chapter 6 Using Cryptography with Images |
|
|
171 | (28) |
|
Simple Image Cryptography |
|
|
171 | (3) |
|
Images and Cryptography Libraries |
|
|
174 | (1) |
|
Understanding the Cryptography Library |
|
|
174 | (1) |
|
Understanding the Cryptosteganography Library |
|
|
175 | (1) |
|
|
|
175 | (12) |
|
File Cryptography Using Fernet |
|
|
176 | (3) |
|
Image Cryptography Using Fernet |
|
|
179 | (1) |
|
AES and Block Modes of Operations |
|
|
180 | (1) |
|
Exploring a Simple ECB Mode Example |
|
|
181 | (4) |
|
Exploring a Simple CBC Mode Example |
|
|
185 | (1) |
|
|
|
186 | (1) |
|
|
|
187 | (10) |
|
Storing a Message Inside an Image |
|
|
188 | (4) |
|
Storing a Binary File Inside an Image |
|
|
192 | (3) |
|
Working with large images |
|
|
195 | (2) |
|
|
|
197 | (2) |
|
Chapter 7 Message Integrity |
|
|
199 | (24) |
|
Message Authentication Codes |
|
|
200 | (10) |
|
Hash-based Message Authentication Code |
|
|
201 | (1) |
|
Using HMAC to Sign Message |
|
|
202 | (1) |
|
|
|
203 | (1) |
|
|
|
204 | (1) |
|
|
|
205 | (1) |
|
|
|
206 | (1) |
|
|
|
207 | (2) |
|
|
|
209 | (1) |
|
The Length Extension Attack |
|
|
209 | (1) |
|
Setting Up a Secure Channel |
|
|
210 | (11) |
|
|
|
211 | (1) |
|
Sending Secure Messages over IP Networks |
|
|
212 | (1) |
|
|
|
212 | (1) |
|
|
|
213 | (1) |
|
Create a Threaded Server with TCP |
|
|
214 | (1) |
|
Adding Symmetric Encryption |
|
|
215 | (3) |
|
Concatenate Message and MAC |
|
|
218 | (3) |
|
|
|
221 | (1) |
|
|
|
222 | (1) |
|
Chapter 8 Cryptographic Applications and PKI |
|
|
223 | (24) |
|
The Public-Key Transformation |
|
|
224 | (11) |
|
Exploring the Basics of RSA |
|
|
226 | (3) |
|
Generating RSA Certificates |
|
|
229 | (2) |
|
Constructing Simple Text Encryption and Decryption with RSA Certificates |
|
|
231 | (1) |
|
Constructing BLOB Encryption and Decryption with RSA Certificates |
|
|
232 | (3) |
|
The El-Gamal Cryptosystem |
|
|
235 | (3) |
|
Elliptic Curve Cryptography |
|
|
238 | (4) |
|
|
|
240 | (1) |
|
|
|
241 | (1) |
|
Diffie-Hellman Key Exchange |
|
|
242 | (3) |
|
|
|
245 | (2) |
|
Chapter 9 Mastering Cryptography Using Python |
|
|
247 | (30) |
|
Constructing a Plaintext Communications Application |
|
|
248 | (5) |
|
|
|
248 | (2) |
|
|
|
250 | (1) |
|
|
|
251 | (1) |
|
|
|
252 | (1) |
|
Installing and Testing Wireshark |
|
|
253 | (2) |
|
Implementing PKI in the Application Using RSA Certificates |
|
|
255 | (6) |
|
|
|
256 | (1) |
|
|
|
257 | (1) |
|
Modifying the Helper File |
|
|
258 | (1) |
|
|
|
259 | (2) |
|
Implementing Diffie-Hellman Key Exchange |
|
|
261 | (15) |
|
Modifying the Server File |
|
|
262 | (2) |
|
Modifying the Client File |
|
|
264 | (2) |
|
Modifying the Helper File |
|
|
266 | (4) |
|
Creating the Diffie-Hellman Class File |
|
|
270 | (5) |
|
|
|
275 | (1) |
|
|
|
276 | (1) |
| Index |
|
277 | |