### Encryption
Take a message
Put it in a box
Lock the box - That is a physical version of Encryption
We have tried to do this virtually using **ciphers**
Ciphers scramble and de-scramble messages
#### Hash vs Encryption
The fundamental difference between hash and encryption techniques is that **hash is irreversible while encryption is reversible**.
Hash algorithms generate a digest of fixed length output cipher text for a given input plain text. The output text cannot be converted back to input text.
#### Caesar Cipher - 58BC
- Shifting letters by agreeing the shift -- A # number to move letters forward by
- Add shift to encrypt
- Subtract shift to decrypt
###### Breaking the Ceasar Cipher
Lock breaking and code breaking is similar
- A lock is only as strong as its weakest point
- Look for mechanical flaws / extract information to narrow down the correct combination
Frequency Analysis by Al Kindi was a blow to the Caesar Cipher, 800 years later
- Used a clue based on an important property of the language the message is written in --> The frequency with which certain letters in a language are used is called the Fingerprint.
![[Pasted image 20210727143449.png]]
- Counting the letter frequency of the encrypted text in the language it is written in Eg. English to check how far the fingerprint has shifted
![[Pasted image 20210727143558.png]]
- 1 of 26 encryptions --> Shifting every letter by the same shift, Easy to check them all
#### Polyalphabetic ciphers
> Strong cipher disguises ones fingerprint, the goal to make a ligther fingerprint and flatten the distribution of letter frequency
> Polyalphabetic Ciphers use Multiple shifts --> Flatter letter distribution, Simply multiple Caesar Ciphers in a string
- Share a secret shift word --> Convert to numbers based on letter position
- longer the shift word stronger the cipher
- Repeat that secret number sequence across the message
- Each letter is encoded by shifting as per the number below it
> Code breakers look for information leak, the same as finding a partial fingerprint
- Every time there is a partial differential in letter frequencies a leak of information occurs. This happens because of **repetition**
![[Pasted image 20210727144244.png]]
> Avoid repetition in secret ciphers for shifts
### One time pad - Strongest Possible Method of Encryption - 19th century
> Designing a cipher that hides your fingerprint to stop a leak of information
** Answer is Randomness
- Shifts never fall into a repetitive pattern
- Encrypted message will form a uniform frequency distribution --> no frequency differential and no leak
No frequency differential and thus no leak
![[Pasted image 20210727145234.png]]
Strength of the one time pad --> Combinatorial explosion
![[Pasted image 20210727150052.png]]
Paper stacked for ALICE as a coded message shifted would be 1 km high with 26x26x26x26x26 possibilities -- Almost twelve million possible 5 letter sequences
----
#security