Download presentation
Presentation is loading. Please wait.
Published byStuart Evans Modified over 9 years ago
1
An Introduction to Hill Ciphers Using Linear Algebra Brian Worthington University of North Texas MATH 2700.002 5/10/2010
2
Hill Ciphers Created by Lester S. Hill in 1929 Polygraphic Substitution Cipher Uses Linear Algebra to Encrypt and Decrypt
3
Simple Substitution Ciphers Work by substituting one letter with another letter. Easy to crack using Frequency Analysis
4
Letter to Letter Substitution ABCDEFGHIJKLM QWERTYUIOPASD NOPQRSTUVWXYZ FGHJKLZXCVBNM Unencrypted = HELLO WORLD Encrypted = ITSSG VKGSR
5
Polygraphic Substitution Ciphers Encrypts letters in groups Frequency analysis more difficult
6
Hill Ciphers Polygraphic substitution cipher Uses matrices to encrypt and decrypt Uses modular arithmetic (Mod 26)
7
Modular Arithmetic For a Mod b, divide a by b and take the remainder. 14 ÷ 10 = 1 R 4 14 Mod 10 = 4 24 Mod 10 = 4
8
Modulus Theorem
9
Modulus Examples
10
Modular Inverses Inverse of 2 is ½ ( 2 · ½ = 1 ) Matrix Inverse: AA -1 = I Modular Inverse for Mod m : (a · a -1 ) Mod m = 1 For Modular Inverses, a and m must NOT have any prime factors in common
11
Modular Inverses of Mod 26 A1257911151719212325 A -1 1921153197231151725 Example – Find the Modular Inverse of 9 for Mod 26 9 · 3 = 27 27 Mod 26 = 1 3 is the Modular Inverse of 9 Mod 26
12
Hill Cipher Matrices One matrix to encrypt, one to decrypt Must be n x n, invertible matrices Decryption matrix must be modular inverse of encryption matrix in Mod 26
13
Modularly Inverse Matrices Calculate determinant of first matrix A, det A Make sure that det A has a modular inverse for Mod 26 Calculate the adjugate of A, adj A Multiply adj A by modular inverse of det A Calculate Mod 26 of the result to get B Use A to encrypt, B to decrypt
14
Modular Reciprocal Example
15
Encryption Assign each letter in alphabet a number between 0 and 25 Change message into 2 x 1 letter vectors Change each vector into 2 x 1 numeric vectors Multiply each numeric vector by encryption matrix Convert product vectors to letters
16
Letter to Number Substitution ABCDEFGHIJKLM 0123456789101112 NOPQRSTUVWXYZ 13141516171819202122232425
17
Change Message to Vectors Message to encrypt = HELLO WORLD
18
Multiply Matrix by Vectors
19
Convert to Mod 26
20
Convert Numbers to Letters HELLO WORLD has been encrypted to SLHZY ATGZT
21
Decryption Change message into 2 x 1 letter vectors Change each vector into 2 x 1 numeric vectors Multiply each numeric vector by decryption matrix Convert new vectors to letters
22
Change Message to Vectors Message to encrypt = SLHZYATGZT
23
Multiply Matrix by Vectors
24
Convert to Mod 26
25
Convert Numbers to Letters SLHZYATGZT has been decrypted to HELLO WORLD
26
Conclusion Creating valid encryption/decryption matrices is the most difficult part of Hill Ciphers. Otherwise, Hill Ciphers use simple linear algebra and modular arithmetic
27
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.