Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cryptanalysis - basic ciphers and a bit more

Cryptanalysis - basic ciphers and a bit more

A basic introduction to cryptanalysis

Aldo Ziflaj

January 13, 2015
Tweet

More Decks by Aldo Ziflaj

Other Decks in Programming

Transcript

  1. W A U G Y J Y O I H

    K Y G L I U G L U K U Y G K U I F K U L Y U T D K R T D Y U K L O I Y U T Y A U G Y J Y O I H I H K Y G L I U G L U K U Y G K U I F K U L Y U T D K A U G W E R G H F D S O J H U I C R Y P T A N A L Y S I S I G U K Y I T U D R D T F H B J N K L I H U Y G U Q A Z X D E D F B A S I C X C I P H E R S J K N L I O U T Y F K U I F A N D Y A T B I T U M O R E G H F D S T E R D T Y U B J N L Y U T D K R T D Y U K L M I J U H Y T Y K U I H L M P U Y T R E R S D T F Y V G U B N I S E R D T M P U G S L B Y X A G I T
  2. Dictionary • Cryptography -- the practice and study of techniques

    for secure communication in the presence of third parties • Cryptanalysis -- the study of analyzing information systems in order to study the hidden aspects of the systems • Cipher -- an algorithm for performing encryption or decryption
  3. Encoding (the Good) • A simple (or not) abstraction level

    • Commonly used in data storage, data transmission, etc. • Examples: ASCII, UTF-8/16/32, Base64, etc. • More examples: Braille alphabet, Morse code, Human DNA, etc.
  4. Encryption (the Bad) • A reversible way of hiding information.

    • Initially used to deliver secret military messages • Two kinds of encryptions: – Symmetric key encryption – Public key encryption • Examples: RSA, AES, Blowfish, etc.
  5. Hashing (the Ugly) • A method of giving a unique

    key (called hash) to some data. • The same input will always produce the same output • Multiple disparate inputs should not produce the same output. • It should not be possible to go from the output to the input. • Any modification of a given input should result in drastic change to the hash (avalanche effect).
  6. A simple hashing algorithm StringHashFunction(string, length) sum ← 0 for

    (i = 1..length-1) sum ← sum + string[i] * 31(length - 1 - i) return sum Foo : 70822 F0oo : 2135050 Bar : 66547
  7. Additive cipher, the real Caesar cipher • Initially used by

    Julius Caesar • Based on right-shifting (addition) or left- shifting (subtraction) of letters of the alphabet A=0, B=1, C=2, …, W=22, X=23, Y=24, Z=25         26 mod 26 mod n x x D n x x E n n    
  8. Additive example: key 23 Ciphertext: QEFSF SXEFA ABKJB PPXDB Plaintext

    : ? W V U T S R Q P O N M L K Z Y X W V U T S R Q P O N J I H G F E D C B A Z Y X M L K J I H G F E D C B A
  9. Affine ciphers • Very similar to additive ciphers • Becomes

    additive cipher when a = 1 • Vulnerable to letter frequency         26 mod 26 mod 1 b x a x D b ax x E     
  10. Affine cipher: example • Plaintext: THIS IS AN EXAMPLE OF

    AFFINE CIPHER • Key: a = 7, b = 11 • Ciphertext: OIPHP HLYNQ LRMKN FULUU PYNZP MINA
  11. One-Time Pad: The secure cipher • Most secure feature: Random

    encryption key H E L L O 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) + 23 (X) 12 (M) 2 (C) 10 (K) 11 (L) = 30 16 13 21 25 = 4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z) HELLO → EQNVZ message; key; key+message; key+message (mod 26)
  12. Symmetric key cryptography • The same key is used for

    both encoding and decoding • Examples: – Blowfish - the base of Bcrypt – SAFER+/++ - used by Bluetooth technology – IDEA - International Data Encryption Algorithm
  13. Small challenge 57 69 74 68 20 67 72 65

    61 74 20 70 6F 77 65 72 20 63 6F 6D 65 73 20 67 72 65 61 74 20 72 65 73 70 6F 6E 73 69 62 69 6C 69 74 79 2C 20 68 69 67 68 20 76 6F 6C 74 61 67 65 20 61 6E 64 20 68 69 67 68 20 63 75 72 72 65 6E 74 2E Decrypt the above message