CSE442T Introduction to Cryptography (Lecture 1)
Chapter 1: Introduction
Alice sending information to Bob
Assuming Eve can always listen
Rule 1. Message, Encryption to Code and Decryption to original Message.
Kerckhoffs’ principle
It states that the security of a cryptographic system shouldn’t rely on the secrecy of the algorithm (Assuming Eve knows how everything works.)
Security is due to the security of the key.
Private key encryption scheme
Let be the set of message that Alice will send to Bob. (The message space) “plaintext”
Let be the set of key that will ever be used. (The key space)
be the key generation algorithm.
denotes cipher encryption.
might be null for incorrect .
The probability of decryption of encrypted message is original message is 1.
*in some cases we can allow the probability not be 1
Some examples of crypto system
Let .
And
Example:
Seems not very secure but valid crypto system.
Early attempts for crypto system
Caesar cipher
def caesar_cipher_enc(s: str, k:int):
return ''.join([chr((ord(i)-ord('a')+k)%26+ord('a')) for i in s])
def caesar_cipher_dec(s: str, k:int):
return ''.join([chr((ord(i)-ord('a')+26-k)%26+ord('a')) for i in s])Substitution cipher
Fails to frequency analysis
Vigenere Cipher
(assuming English alphabet)
def viginere_cipher_enc(s: str, k: List[int]):
res=''
n,m=len(s),len(k)
j=0
for i in s:
res+=caesar_cipher_enc(i,k[j])
j=(j+1)%m
return res
def viginere_cipher_dec(s: str, k: List[int]):
res=''
n,m=len(s),len(k)
j=0
for i in s:
res+=caesar_cipher_dec(i,k[j])
j=(j+1)%m
return resOne time pad
Completely random string, sufficiently long.
(assuming English alphabet)$
def one_time_pad_enc(s: str, k: List[int]):
return ''.join([chr((ord(i)-ord('a')+k[j])%26+ord('a')) for j,i in enumerate(s)])
def one_time_pad_dec(s: str, k: List[int]):
return ''.join([chr((ord(i)-ord('a')+26-k[j])%26+ord('a')) for j,i in enumerate(s)])