**I’ve been reading The Manga Guide to Cryptography and POC||GTFO to learn more about crypto. I’m just trying out digitizing some of my notes here, though I’m thinking a wiki like docuwiki would be better. OneNote isn’t really floating my boat lately. Anyway, this shouldn’t be taken as original writing, or a finished article, and I will cite direct quotes when necessary**
A. Shannon’s Encryption Model
Plaintext(m); Ciphertext(C); Encryption Key (EK); Decryption Key (DK)
m-> Encryption (With Key EK)-> C
C->Decryption (With Key DK)-> m
B. Substitution Cipher
In a substitution cipher, characters in m are converted by EK to a specific other letter.
Example: Ceaser’s Cipher
Conversion Rule (sigma): shift each letter n times ; n=3*
Ceaser Cipher Key Space: 23; (Total letters)-1= Key Space size
C. Polyalphabetic Cipher
Scrambling the alphabet would increase the key space based on how many permutations are possible.
26P26=26! *=* 4.0329*10^26
Read as: From a set of 26 things, all unique arrangements of 26 items = is equal to factorial (26) = 4.0329*10^26
It is computationally infeasible to test all of these possible keys based on a 26 letter alphabet, so frequency analysis is used to gain clues to the cipher.
D. Relevant Mathematics
- Permutation: Way to determine the uniquely ordered combinations of r things from the total set n.
nPr= n*(n-1)*…(n-r+1)= n!/(n-r)!
26P3= 26!/23! = 26*25*23 = 15,600
- Combination: Way to determine the unique combinations of r things from the total set n when order does not matter
nCr= (nPr/r!)= (n!)/((n-r)!*r!)
26!/23!*3! = 26*25*24 / 1*2*3 = 15,600 / 6 = 2,600 combinations
Take Away: There are far more permutations of n than there are combinations
Frequency Analysis based on the features of the ciphertext, or known statistics about it, guesses can be made about the plaintext or encryption key. It’s highly effective against simple substitution ciphers.
Example: The most common letter in the english alphabet is E and the most common word is THE so repeats or common characters in the ciphertext can hint at the key, or plaintext.