Document Details

EvocativeOrientalism

Uploaded by EvocativeOrientalism

Bicol University

Jevha Rea Montas

Tags

applied cryptography cryptography algorithms security algorithms encryption methods

Summary

This document is an introduction to cryptography and security algorithms, covering various types of algorithms, such as substitution, transposition, Caesar, and Playfair ciphers. It includes examples of algorithms, steps involved in encrypting and decrypting messages, and focuses on the fundamental concepts of cryptography mechanisms. The document also features questions for practicing the learned concepts.

Full Transcript

Bicol University College of Science Applied Cryptography Introduction to Cryptography and Security Algorithms Instructor: Jevah Rea Montas GEC Elect 21.4 - Living in the IT Era Introduction to Cryptography and security algorithms Algorithm A well-ordered collection of unambiguous and...

Bicol University College of Science Applied Cryptography Introduction to Cryptography and Security Algorithms Instructor: Jevah Rea Montas GEC Elect 21.4 - Living in the IT Era Introduction to Cryptography and security algorithms Algorithm A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time. Examples: Recipes Instructions for assembling things Directions how to get to places Makeup tutorials Teardown instructions Repair guides Steps for shampooing hair Algorithm STEP OPERATION 1 Wet your hair 2 Lather your hair 3 Rinse your hair 4 Lather your hair 5 Rinse your hair 6 Stop, you have finished shampooing your hair Algorithm for calculating GPA (Grade Point Average) Algorithm STEP OPERATION 1 total_gp = 0 2 course_count = 0 3 Repeat steps 4-5 for all your courses 4 total_gp = total_gp + grade in courses 5 course_count = course_count + 1 6 GPA = total_gp / course_count 7 Print the value of GPA 8 Stop. Algorithms Why are algorithms important? If we can specify an algorithm to solve a problem, then we can automate its solution. If we can discover an algorithm to perform a task, we can instruct a computing agent to execute it and solve the problem for us Cryptography What is cryptography? The art of achieving security by encoding messages to make them non-readable. The study of principles and techniques through which information can be hidden in a cipher. The process of converting ordinary information (called plaintext) into unintelligible text (called ciphertext) TERMINOLOGY Fundamentals of Cryptography Cryptology The science of encryption, which encompasses cryptography and cryptanalysis. Cryptography The process of making and using codes to secure the transmission of information. Cryptanalysis The process of obtaining the plaintext message from a ciphertext message without knowing the keys used to perform the encryption. Cryptanalyst A person who attempts to break a cipher text message to obtain the original plain text message. TERMINOLOGY Fundamentals of Cipher Cryptography An encryption method or process encompassing the algorithm, key(s) and procedures used to perform encryption and decryption. Encryption (or enciphering) Is the process of using the key to produce ciphertext from plaintext. Decryption (or deciphering) Is the process of using the key to produce plaintext from ciphertext. Key Info used in cipher known only to sender/receiver. The key can be a passphrase. Plaintext The original unencrypted message, or a message that has been successfully decrypted. Cryptographic Algorithms 3 Dimensions of Classifying Cryptographic Systems Type of operation used (Cryptography Mechanism) Transposition Substitution, etc. Number of Keys used 1, 2, 3... Way of processing plaintext Block Cipher Stream Cipher, etc. Cryptographic Algorithms According to type of operation used Substitution (Confusion) Replace one or more characters with other characters. Substitution ciphers preserve the order of plaintext letters but disguise them. cryptography = yeyptokenphy c = y; r = e; g = k; a = n Transposition (Diffusion) Rearrange one or more characters within the text. Transposition ciphers reorder the letters but do not disguise them. cryptography = ocyrhyppatrg 2 4 6 7 10 1 12 11 9 8 5 3 Cryptographic Algorithms According to type of operation used Substitution (Confusion) kinds: Monoalphabetic Cipher Also known as a simple substitution cipher, relies on a fixed replacement structure. It is easy to break because they reflect the frequency data of the original alphabet. There are 26! or greater than 4x(10)^26 possible keys. Weak cipher. Plaintext: there was something about you Key: VDHCIMRPXQJUFYLBTSZOWNGKEA Ciphertext: OPISI GVZ ZLFIOPXYR VDLWO ELW Cryptographic Algorithms According to type of operation used Answer these: Monoalphabetic Cipher Plaintext: that now I cant remember Key: VDHCIMRPXQJUFYLBTSZOWNGKEA Ciphertext: ? Plaintext: ? Key: VDHCIMRPXQJUFYLBTSZOWNGKEA Ciphertext: X OPXYJ VDLWO ELW Cryptographic Algorithms According to type of operation used Substitution (Confusion) example: Caesar Cipher (ex. of monoalphabetic cipher) Also known as the Shift Cipher Earliest known cipher and also the simplest. Involves replacing each letter of the alphabet with the letter standing three places further down the alphabet shift = 3 The letters are wrapped ABCDEFGHIJKLMNOPQRSTUVWXYZ DEFGHIJKLMNOPQRSTUVWXYZABC Cryptographic Algorithms According to type of operation used Substitution (Confusion) example: Playfair Cipher (ex. of monoalphabetic cipher) The best-known multiple-letter encryption cipher is the Playfair, which treats diagram in the plaintext as single units and translates these units into cipher diagram. The Playfair algorithm is based on the use of a 5x5 matrix of letters constructed using a keyword. Plaintext in encrypted two letters at a time. Cryptographic Algorithms According to type of operation used Playfair Cipher key Setup: 1. Generate the key Square(5×5): a. Choose a key/ keyword and write it at the top of the 5x5 matrix. b. Fill the rest of the spaces with the alphabet. c. Don’t write letters found in the keyword, each must be unique. Write I and J in the same box. If the plaintext contains J, then it is replaced by I. Key: MONARCHY Plaintext: INSTRUMENTS Cryptographic Algorithms According to type of operation used Playfair Cipher Setup: 2. Algorithm to encrypt the plain text: a. The plaintext is split into pairs of two letters (digraphs). If there is an odd number of letters, a Z is added to the last letter. PlainText: "instruments" After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz' b. Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter. Plain Text: “hello” After Split: ‘he’ ‘lx’ ‘lo’ Cryptographic Algorithms According to type of operation used Playfair Cipher Rules for Encryption: If both the letters are in the same column: Take the letter below each one (going back to the top if at the bottom). Diagraph: “me” Encrypted text: “cl” Encryption: m -> c | e -> l Cryptographic Algorithms According to type of operation used Playfair Cipher Rules for Encryption: If both the letters are in the same row: Take the letter to the right of each one (going back to the leftmost if at the rightmost position). Diagraph: “st” Encrypted text: “tl” Encryption: s -> t | t -> l Cryptographic Algorithms According to type of operation used Playfair Cipher Rules for Encryption: If neither of the above rules is true: Form a rectangle with the two letters and take the letters on the horizontal opposite corner of the rectangle. Diagraph: “nt” Encrypted text: “rq” Encryption: n -> r | t -> q Cryptographic Algorithms According to type of operation used Plaintext: "instrumentsz" Encrypted text: gatlmzclrqtx Encryption: i -> g n -> a s -> t t -> l r -> m u -> z m -> c e -> l n -> r t -> q s -> t z -> x Cryptographic Algorithms According to type of operation used Substitution (Confusion) kinds: Polyalphabetic Cipher A polyalphabetic cipher is any cipher based on substitution, using multiple substitution alphabets. Vigenère Cipher (ex. of polyalphabetic cipher) It uses a simple form of polyalphabetic substitution. The encryption of the original text is done using the Vigenère square or Vigenère table. The table consists of the alphabets written out 26 times in different rows. Vigenère Square Cryptographic Algorithms According to type of operation used Vigenère Cipher: For generating key, the given keyword is repeated in a circular manner until it matches the length of the plain text. The keyword "BLUSH" generates the key "BLUSHBLU" Plaintext: DAYLIGHT Keyword: BLUSH Key: BLUSHBLU Cryptographic Algorithms According to type of operation used row Vigenère Cipher (Encryption) The first letter of the plaintext, D is paired with B, the first letter of the key. So use row D and column B of the Vigenère square, namely E. Plaintext: DAYLIGHT Keyword: BLUSH Key: BLUSHBLU Ciphertext: E...? column Vigenère Square Cryptographic Algorithms According to type of operation used row Vigenère Cipher (Decryption) Decryption is performed by going to the row in the table corresponding to the key, finding the position of the ciphertext letter in this row, and then using the column’s label as the plaintext. For example, in row B (from BLUSH), the ciphertext E appears in column D, which is the first plaintext letter. Plaintext: DAYLIGHT Keyword: BLUSH Key: BLUSHBLU Ciphertext: ELSDPHSN column Vigenère Square Cryptographic Algorithms According to type of operation used Transposition (Diffusion) example: Rail Fence Technique The rail fence cipher’s encryption process requires choosing the number of rails, writing the message diagonally in a zigzag pattern determined by the selected number of rails, and then combining the characters along each rail from left to right to obtain the encrypted message. Plaintext: MONDAY M N A Key: 2 Ciphertext: MNAODY O D Y Cryptographic Algorithms According to type of operation used Transposition (Diffusion) example: Simple Columnar Transposition F A N C Y Columnar Transposition involves writing the plaintext oder in alphabet out in rows, and then reading the ciphertext off in 3 1 4 2 5 columns one by one. plaintext is written across-wise m e e t m Plaintext: meet me at next midnight Key: FANCY e a t n e Ciphertext: eatltnlhmexnetmgmedt x t m i d To decipher it, the recipient has to work out the column lengths by dividing the message length by n i g h t the key length. 20/5 = 4 rows ciphertext is read column-wise Activity: Caesar Cipher Caesar Cipher 1 - Encrypt Create an implementation of Caesar Cipher. Your program should have 2 components, 2 - Decrypt encrypting and decrypting. The user should be allowed to select decryption or encryption in >1 the terminal. The program should ask the user how many places to shift the values Places to shift: 3 Saved to text file. regardless of choice. If encryption is chosen, the message is inputted by the user and outputted to the file msg.txt. If decryption is chosen, the ciphertext is read from msg.txt and the decrypted message is shown on screen. 1 - Encrypt 2 - Decrypt >2 Places to shift: 3 Plaintext: Hello World! End of Lesson REFERENCES HTTPS://WWW.GEEKSFORGEEKS.ORG/HILL-CIPHER/ HTTPS://WWW.GEEKSFORGEEKS.ORG/VIGENERE-CIPHER/ HTTPS://WWW.GEEKSFORGEEKS.ORG/DIFFERENCE- BETWEEN-MONOALPHABETIC-CIPHER-AND- POLYALPHABETIC-CIPHER/ HTTPS://WWW.GEEKSFORGEEKS.ORG/COLUMNAR- TRANSPOSITION-CIPHER/ CRYPTOGRAPHY AND NETWORK SECURITY PRINCIPLES AND PRACTICE BY WILLIAM STALLINGS

Use Quizgecko on...
Browser
Browser