1 / 20

Basic Cryptography

Basic Cryptography. Some examples taken from “Coding Theory and Cryptography, the essentials” Second Edition Hankerson, et.al. 2000, Marcel Dekker, Inc Slides by Dannelly. Terms. Plaintext – the readable message Ciphertext – the coded message. Levels of Security.

serge
Télécharger la présentation

Basic Cryptography

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Cryptography Some examples taken from “Coding Theory and Cryptography, the essentials” Second Edition Hankerson, et.al. 2000, Marcel Dekker, Inc Slides by Dannelly

  2. Terms • Plaintext – the readable message • Ciphertext – the coded message

  3. Levels of Security • Unconditionally Secure– impossible to break, even if the adversary has unlimited ciphertext and unlimited computing power • Computationally Secure– only infeasible (not impossible) to break the code • Provably Secure– intractable problem

  4. Types of Attacks • Ciphertext Only– adversary uses just the ciphertext to gain either the key or the plaintext (really bad) • Known Plaintext– adversary gets the key using some ciphertext and its plaintext • Chosen Plaintext– adversary introduces some plaintext to generate some ciphertext

  5. Symmetric Key Encryption • Both parties share a key • The single key is used for both encryption and decryption • Encryption and decryption are equal efforts

  6. Shift Ciphers key = amount to shift each character Example: Rotate13 ‘A’ + 13 = 1 + 13 = 14 = ‘N’ So, the message “aardvark” becomes “nneqinex”.

  7. Shift Ciphers Advantage of Rot13: Easy to implement. Rot13('A') = 'N' (1 + 13)%26 = 14 Rot13('N') = 'A' (14 + 13)%26 = 1 So, one function does both encoding and decoding. Disadvantage of Any Rotation: Very easy to break – just try all 26 possibilities.

  8. Substitution Cipher Key = list of character substitutions Example: Key = “Chair” 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 Y Z c h a i r B D E F G J K L M N O P Q S T U V W X Disadvantage: Susceptible to Character Frequency Analysis

  9. Character Frequencies

  10. Character Frequencies

  11. Polyalphbetic Ciphers Key is repeated and used to shift characters. Example plaintext now is the time for all + key aar dv ark aard var kaa Ciphertext opo mo uzp ujei bpj lmm

  12. Polyalphbetic Ciphers Advantage: Thwarts character frequency analysis. For example, an “e” will encrypt to several different letters. Disadvantage: Statistics can still be used to break the code.

  13. Polyalphbetic Ciphers How to Break Them: 1 - Look for repeated strings. For example, if the characters “thi” appear together frequently, then it could be because the key is hitting a common word. Text = and we need to test and retest Key = ste ve stev es teve ste vestev Sum = thi sj gyjz yh njoy thi njmyxp

  14. Polyalphbetic Ciphers How to Break Them: 2 – Determine Probable Key Length The start of strings “thi” are frequently separated by distances that are multiples of 5. So, key length is probably five. 3A – Try keys of that length. 3B – Use CharFreqAnal on characters separated by that length.

  15. One-Time Pad • Key is used to shift the plaintext. • Key is used only once. • Key has same length as the message. • Advantage: Unbreakable! • Disadvantage: Requires lots of keys.

  16. Hashing • Recall a hash function can be used to "randomly" spread out data and yet still determine where to find data. • For example • hash("steve") = 5, so look in file 5 for steve's data. • hash("bob") = 42, so look in file 42 for bob's data

  17. Sample Hash Function int hash (char[] name) { int sum=0; for (int I=0; I<name.length; I++) sum += name[I]; return sum%tablesize; }

  18. Java's Message Digest • Java provides several hash functions that turn a message into a "message digest". H(msg) = digest • The digest is always the same length, no matter the msg length. • Given a digest, you can not determine either msg or H.

  19. Common Use : verify validity • To Send: • Use a prearranged scheme to determine the Hash function. • Generate message digest from msg. • Send both msg and message digest. • To Verify Received msg: if (Hash(msg) == digest) msg is okay

  20. Sample Code MessageDigest md; byte[] digest; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { return -1; } md.reset(); md.update(first_quarter_of_msg); md.update(forth_quarter_of_msg); md.update(second_quarter_of_msg); md.update(third_quarter_of_msg); digest = md.digest(); This should match the received digest Several Choices of Secure Hash Functions This is the secret part

More Related