# More Encryption

• Keys
• Most encryption algorithms rely on a key.
• Noted as K in the symbolic representation.
• This is a parameter to the algorithm used to form the encrypted message.
• By changing the key, the message is encrypted differently.
• C = E(K,P), P = D(K, C)
• Since a single key is used for both encryption and decryption this is called a symmetric key, single-key or secret key encryption
• If the algorithm is well known, then this key must be kept secret for the encryption to hold.
• Consider the Playfair cipher.
• One version
• Build an encryption key
• Remove duplicate letters, for this case i=j.
• Form a square by writing the letters down in rows of 5.
• Fill in the remaining square with unused letters in order
• Example: Keyword Edinboro -> edinbor
•  e d i/j n b o r a c f g h k l m p q s t u v w x y z
• Rules for encryption/decryption
• Take the plaintext and split it into letter pairs
• If a pair contains the same letter insert an x
• If the last letter is not paired, add an x.
• Find the letters in the table
• If they are in the same row, shift each letter to the right by one, wrapping to the right if necessary
• If they are in the same column, shift each letter down by one, wrapping to the top if necessary
• Otherwise the letters form a square. Find the alternative corners of the square and use the letter on the same row for substation.
• Example plaintext: the attack is at dawn
Letter Pairs:     th ea tt ac ki sa td aw n
Split Duplicates: th ea tx ta ck is at da wn
th -> ql
ea -> io
tx -> sy
ta -> sc
ck -> al
is -> ax
at -> cs
da -> ir
wn -> yd
ciphertext qliosyscalaxcsiryd
• How would you decode?
• Encrypt "Send More Monkeys" with the keyword "Fun Times"
• Decode "PFYIATMETALCQW" with the keyword "crypto"
• Here is an app to do this.
• Other systems employ two keys
• One key for encryption $K_e$ and one for decryption $K_d$
• $C = E(K_e, P)$ and $P = D(K_d, C)$
• In this case, this is called asymmetric encryption
• These will become extremely valuable soon.
• Symmetric vs asymmetric
• Symmetric systems are frequently used for a longer term message exchanges
• Users somehow swap a valid key
• Then communicate encrypting and decrypting with this key.
• Think exchanging a key, build a playfair cypher then sending messages back and forth using this table.
• The key needs to be private.
• And key exchange is a real problem.
• Asymmetric systems usually conist of a public key and a private key
• We will look at these in more deatil later but
• $K_{pub}$ and $K_{priv}$ are the keys in this system.
• $P = D(K_{pub}, E(K_{priv}, P))$
• I can encrypt a message with my private key, and you can decript it with my public key
• You since I am the only person who knows my private key, I am the only person who could have created this message.
• $P = D(K_{priv}, E(K_{pub}, P))$
• I can decrypte a message with my private key that you encrypted with my public key.
• I am the only person who can do this.
• We can use a puiblic key/private key system to ecchange symmetric keys.
• And other things.
• The main problem is validating my public key.
• These are done by key-distribution services.
• And key management is a problem.
• A system with no key is a keyless cipher.
• Another way to look at computer based ciphers is block vs stream
• A stream cipher encrypts a minimal amount of information.
• Think caeser, each letter is encrypted independently.
• No padding is needed.
• A block cipher, on the other hand must encrypt a fixed size or block of the plain text.
• Think playfair
• You need a minimum of two letters.
• If you don't have sufficient characters, you must pad.
• Many modern ciphers use block sizes of 64, 128, 256, ...
• sha-256 are an example of this.