Download presentation
1
CSCI 5857: Encoding and Encryption
Modern Block Ciphers CSCI 5857: Encoding and Encryption
2
Outline Binary blocks and keys The XOR function
Structure of modern round cipher Permutation and Substitution boxes
3
Block Ciphers Long plaintext messages broken up into blocks
Encryption substitutes n bit block of ciphertext for n bit block of plaintext Example: Key question: Good block size 8 bits too small: just maps one ASCII character to another (monoalphabetic cipher) Usually 64, 128, 256, or 512 bits
4
Binary Keys Key: Binary number 32 to 256 bits long
Minimum size now 128 bits to defeat exhaustive search attacks Amount of information stored by key is limited (128 bit key equivalent to 16 ASCII characters)
5
Substitution and Block Ciphers
Standard binary key insufficient to represent even simple monoalphabetic substitution cipher Example: Block size 64 bits 264 possible blocks, each of which needs a corresponding ciphertext block listed Key: 264 x 64 bits long >> 256 bits for normal binary key Number of mappings with 256-bit key << all possible mappings of 64 bit blocks
6
Transposition and Binary Text
Transposition ciphers of binary text easy to break Small alphabet reduces distinguishable permutations encrypted with Example: 64-bit ciphertext block with 8 1’s and 56 0’s Only (64 x 63 x 62 x 61 x 60 x 59 x 58 x 57)/ (8 x 7 x 6 x 5 x 4 x 3 x 2 x 1) = 4,426,165, combinations of 8 1’s and 56 0’s Easily broken with exhaustive search (each successive block reduces number of possible combinations)
7
Binary Functions Since both text and key binary, can use binary function to encrypt/decrypt Example: AND function Plaintext: Key: Ciphertext:
8
Invertible Binary Functions
Problem: Binary function must be invertible Otherwise, cannot uniquely decrypt message AND not invertible Plaintext: ? could be either 1 or 0 Key: 0 Ciphertext: 0 ???
9
Exclusive Or Function (XOR)
Definition: 1 if operands not equal 0 if operands equal Plaintext P K C = P K 1 Key Ciphertext
10
XOR is Invertible XOR is its own inverse: C = P K P = C K 1
encryption C = P K K P must be: 1 Plaintext Plaintext Key Ciphertext Ciphertext decryption
11
XOR and Block Ciphers Most modern block ciphers use XOR to produce ciphertext from plaintext and key Simple Example (8 bit key and blocks): Encryption: Plaintext: Key: Ciphertext: Decryption: Ciphertext: Key: Plaintext:
12
XOR Alone is Breakable K = P C Plaintext Ciphertext Key
Key can be computed from single known plaintext “This is too easy!”
13
Confusion and Diffusion
Hiding relationship between plaintext and ciphertext Changing one plaintext bit should change many bits in ciphertext Confusion: Hiding relationship between ciphertext and key Changing one key bit should change many characters in ciphertext
14
Product Cipher Substitution and permutation can be used to add diffusion and confusion adds diffusion Substitution permutation Substitution permutation Plaintext Ciphertext Substitution permutation adds confusion Key
15
Invertibility Transformations on plaintext must be invertible
Transformations on key do not Don’t care if can’t recover key from ciphertext Must be invertible Substitution permutation Substitution permutation Plaintext Ciphertext Substitution permutation Does not have to be invertible Key
16
Rounds in Product Cipher
Most ciphers have many rounds of substitution, permutation, and XOR Maximizes diffusion round 1 round 2 round n subst/perm subst/perm subst/perm P … C key 1 key 2 key n
17
Key Generation Most ciphers generate separate round keys from main key using substitution/permutation round 1 round 2 round n subst/perm subst/perm subst/perm P … C round key 1 round key 2 round key n … subst/perm subst/perm subst/perm main key K
18
Keyless Ciphers Substitution/permutation not based on key
“Hardwired” into cipher Assume known by adversary Simply used to add diffusion/confusion round i “I know this, but still can’t figure out what P and K are” subst/perm C P … … subst/perm K
19
P-Boxes for Permutation
Number in box gives position of corresponding input bit in output Example: 16-bit P-Box Input Output
20
Invertible P-Boxes P-Box invertible if each input maps to one and only one output Example: Same 16-bit P-Box Swap numbers and indices Resort by indices
21
Shift and Swap P-Boxes Shift Box moves inputs over by some n bits
May be circular, shifting bits at end to beginning Example: 8-bit right circular shift box Swap box swaps two or more blocks of bits Example: swapping two adjacent 4-bit blocks
22
Compression/Expansion P-Boxes
Compression P-Box: Not all inputs map to an output Example: 8 x 6 P-Box 8 inputs, only 6 outputs Note that inputs 3 and 5 do not map to an output
23
Compression/Expansion P-Boxes
Expansion P-Box: Some inputs map to multiple outputs Example: 8 x 12 P-Box 8 inputs, 12 outputs Note that inputs 1, 4, 5, and 7 map to two different outputs
24
Compression/Expansion P-Boxes
Compression and Expansion P-Boxes not invertible Compression boxes lose information Can invert expansion box only if output has identical values corresponding to inputs that are duplicated 1010 11010 ? 10010 Used primarily in key generation Example: Creating bit round keys from single 128-bit key
25
S-Boxes for Substitution
Map blocks of plaintext to ciphertext Example: 3 x 3 S-Box Often simplify by making “2 dimensional” Example: First bit of input determines row of output Input 000 001 010 011 100 101 110 111 Output 00 01 10 11 011 101 111 100 1 000 010 001 110
26
Invertible S-Boxes Must have same number of inputs and outputs
Example: 3 x 2 compression S-Box Each output must be unique 00 01 10 11 1 Input 000 001 010 011 100 101 110 111 Output
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.