4.6 Cryptography Flashcards
Encryption:
The process of making a message secret.
Caesar cipher:
To express Caesar’s encryption process mathematically, first replace each letter by an element of Z26, that is, an integer from 0 to 25 equal to one less than its position in the alphabet. For
example, replace A by 0, K by 10, and Z by 25. Caesar’s encryption method can be represented
by the function f that assigns to the nonnegative integer p, p ≤ 25, the integer f(p) in the set
{0, 1, 2, … , 25} with
f( p) = ( p + 3) mod 26.
In the encrypted version of the message, the letter represented by p is replaced with the letter
represented by ( p + 3) mod 26.
Decryption:
The process of determining the original message from the encrypted message is called
decryption.
Decrypt Caesar Cipher:
To recover the original message from a secret message encrypted by the Caesar cipher, the
function f −1, the inverse of f , is used. Note that the function f −1 sends an integer p from Z26,
to f −1(p) = (p − 3) mod 26. In other words, to find the original message, each letter is shifted
back three letters in the alphabet, with the first three letters sent to the last three letters of the
alphabet.
Shift Cipher:
Whats key?
Generalized Caesar Cipher. f(p) = (p + k) mod 26. Such a cipher is called a shift cipher. Note that decryption can be carried out using f −1 (p) = (p − k) mod 26. Here the integer k is called a key.
Affine cipher:
Shift cipher with slightly enhanced security.
f( p) = (ap + b) mod 26,
where a and b are integers, chosen so that f is a bijection. (The function f(p) = (ap + b) mod 26
is a bijection if and only if gcd(a, 26) = 1.) Such a mapping is called an affine transformation,
and the resulting cipher is called an affine cipher.
How to decrypt messages encrypted using an affine cipher?
Suppose
that c = (ap + b) mod 26 with gcd(a, 26) = 1. To decrypt we need to show how to express p in
terms of c. To do this, we apply the encrypting congruence c ≡ ap + b (mod 26), and solve it
for p. To do this, we first subtract b from both sides, to obtain c − b ≡ ap (mod 26). Because
gcd(a, 26) = 1, we know that there is an inverse a of a modulo 26. Multiplying both sides of
the last equation by a gives us a(c − b) ≡ aap (mod 26). Because aa ≡ 1 (mod 26), this tells
us that p ≡ a(c − b) (mod 26). This determines p because p belongs to Z26
CRYPTANALYSIS:
The process of recovering plaintext from ciphertext without knowledge
of both the encryption method and the key is known as cryptanalysis or breaking codes.
Cryptanalysis if u know shift cipher was used:
One way: we can try to recover the message by shifting all characters of the ciphertext by each
of the 26 possible shifts (including a shift of zero characters). One of these is guaranteed to be
the plaintext.
Other way:
The main tool for cryptanalyzing cipher- text encrypted using a shift cipher is the count of the frequency of letters in the ciphertext.
The nine most common letters in English text and their approximate relative frequencies are E 13%,
T 9%, A 8%, O 8%, I 7%, N 7%, S 7%, H 6%, and R 6%.
First hythesize that most frequent letter is E, if it makes sense then true otherwise go for T.
character or
monoalphabetic ciphers.
Shift ciphers and affine ciphers proceed by replacing each letter of the alphabet by another letter in the alphabet. Because of this, these ciphers are called character or monoalphabetic ciphers.
Encryption methods of this kind are vulnerable to attacks based on
the analysis of letter frequency in the ciphertext.
Block Ciphers:
We can make it harder
to successfully attack ciphertext by replacing blocks of letters with other blocks of letters instead of replacing individual characters with individual characters; such ciphers are called block
ciphers.
Transposition Cipher:
Encryption and decrption:
As a key we use a permutation 𝜎 of the set {1, 2, … , m} for some positive integer m, that is, a
one-to-one function from {1, 2, … , m} to itself.
To encrypt a message we first split its letters
into blocks of size m. (If the number of letters in the message is not divisible by m we add
some random letters at the end to fill out the final block.)
We encrypt the block p1p2 … pm as
c1c2 … cm = p𝜎(1)p𝜎(2) … , p𝜎(m).
To decrypt a ciphertext block c1c2 … cm, we transpose its letters using the permutation 𝜎−1, the inverse of 𝜎.
Example 6 to understand.
CryptoSystem:
A cryptosystem is a five-tuple (P, C, K, E, D), where P is the set of plaintext strings,
C is the set of ciphertext strings,
K is the keyspace (the set of all possible keys),
E is the set of encryption functions, and
D is the set of decryption functions.
We denote by Ek the encryption
function in E corresponding to the key k and Dk the decryption function in D that decrypts
ciphertext that was encrypted using Ek, that is, Dk(Ek(p)) = p, for all plaintext strings p.
Describe the family of shift ciphers as a cryptosytem.
To apply the definition of a cryptosystem to shift ciphers, we assume that our messages are already integers,:
that is, elements of Z26. That is, we assume that the translation between letters and integers is
outside of the cryptosystem. Consequently, both the set of plaintext strings and the set of
ciphertext strings are the set of strings of elements of Z26. The set of keys is the set of
possible shifts, so = Z26. The set consists of functions of the form Ek(p) = (p + k) mod 26,
and the set of decryption functions is the same as the set of encrypting functions where
Dk(p) = (p − k) mod 26.
Private key cryptosystems :
All classical ciphers, including shift ciphers and affine ciphers, are examples of private key
cryptosystems. In a private key cryptosystem, once you know an encryption key, you can
quickly find the decryption key. So, knowing how to encrypt messages using a particular key
allows you to decrypt messages that were encrypted using this key.
- When a private key cryptosystem is used, two parties who wish to communicate in secret
must share a secret key. Because anyone who knows this key can both encrypt and decrypt messages, two people who want to communicate securely need to securely exchange this key