CRYPTOGRAPHY Digital Diva March 2012 Eastern Michigan University Professor S. Haynes, shaynes@emich.edu Definitions Plaintext: Ciphertext: an unencrypted message an encrypted message Cipher: encrypt, ciphertext, encryption algorithm Encryption: transforming plaintext into ciphertext so that the plaintext is kept a secret; this usually requires use of a key. Decryption: key. transforming ciphertext into plaintext; this usually requires use of a Encode: transform something into something else. For example, English Spanish, letters to numbers (a, b, c, …, z) (1, 2, 3, … 26). Decode: undo an encoding (Spanish English; (1, 2, 3, … , 26) (a, b, c, … z) ). Algorithm: A sequence of instructions to accomplish something. An algorithm is like a recipe. A computer algorithm uses data (ingredients) and instructions to modify the data. Key: Something that is known to the sender and the receiver of a message and is used to encrypt and decrypt messages. The key is the most important single thing to protect the security (secrecy) of the message. Secret key (aka private key, symmetric key, shared key): the sender and the receiver have exactly the same key. The sender encrypts with the secret key, the receiver decrypts with the same secret key. Public key (aka asymmetric key): a key that comes in two parts: (1) public and (2) private. The sender encrypts with the private part, the receiver decrypts with the public part. Shift cipher: To encrypt plaintext, shift each plaintext letter to the right by key steps. To decrypt ciphertext, shift each ciphertext letter to the left by key steps. Substitution cipher: Each plaintext letter is converted to a specific cipher text letter; each cipher text letter is decrypted to the original plaintext letter. Steganography: the secret message is hidden in another message. Modular arithmetic: The rules for addition (subtraction) and multiplication (division) in a list of consecutive integers like 0, 1, 2, 3. We do modular arithmetic when using a 12 hour clock, a 7 day week, a 12 month year. Anything that does wrap-around can be described using modular arithmetic. To do modular arithmetic, you have to start with 0. So for a 12 hour clock: 0, 1, 2, … , 11; for English letters: (a, b, c, …, z) (0, 1, 2, … 25). Modulus: the number of consecutive integers being used in modular arithmetic. For letters in English, the modulus is 26 (mod 26), for hours on a 12-hour clock: mod 12, for months in a year: mod 12, for days in a week: mod 7. Shift cipher 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 a b c d e f g h i j k l m n o p q r s t u v w x y z Caesar Cipher: The Story Shared key: 3 Encryption algorithm: Each plaintext letter is encrypted as the letter three spaces to the right with wrap-around. Decryption algorithm: Each ciphertext letter is encrypted as the letter three spaces to the left with wrap-around. Example Encryption Plaintext: Ciphertext: lazy one odcb rqh Example Decryption Ciphertext: Plaintext: tzlc quiz To implement this on the computer - Encode plaintext character c as x, where x is an integer 0 – 25 (see above) X = encode(p) - Encrypt x using Caesar cipher algorithm y = ( x + 3 ) mod 26 - Decode y to ciphertext character c = decode(y) Decryption algorithm: Encode and decode as above. Decrypt X = ( y – 3 ) mod 26 plaintext: Encode: take more quizzes 19 0 10 4 12 14 17 4 16 20 8 25 25 4 18 Encrypt: Ciphertext: 24 3 13 7 15 17 20 7 19 23 11 2 2 7 21