The Secure Hill Cipher Jeff Overbey MA464-01 • Dr. Jerzy Wojdyło • April 29, 2003 Based on S. Saeednia. How to Make the Hill Cipher Secure. Cryptologia 24 (2000) 353–360. The Scenario The Scenario Alice The Scenario Bob The Scenario Oscar The Scenario The Scenario Insecure Channel Sender Recipient Nosy Neighbor Hill Cipher Beforehand… Alice and Bob privately share matrix K, invertible over Zm To encrypt a matrix X over Zm… Compute Y = KX Send Y To decrypt Y… Compute X = K–1Y Why the Hill Cipher Isn’t Secure Insecure Channel Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure “Hey Bob, wassup?” Insecure Channel Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure 7 1 22 18 Insecure Channel X 4 14 0 20 24 1 18 15 Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure 11 23 10 Insecure Channel K 16 19 24 20 4 23 Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure Insecure Channel Y = KX Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure 6 2 19 5 Channel Y Insecure 10 20 4 14 6 21 22 5 Sender Recipient Nosy Neighbor Why the Hill Cipher Isn’t Secure 19 5 6 2 10 Insecure Channel 20 4 14 6 21 22 5 Sender Recipient HEYBOBWAS Nosy Neighbor Why the Hill Cipher Isn’t Secure 19 5 6 2 10 Insecure Channel 20 4 14 6 21 22 5 23 10 11 Recipient K 16 19 24 20 4 23 Sender HEYBOBWAS Nosy Neighbor Why the Hill Cipher Isn’t Secure 19 5 6 2 10 Insecure Channel 20 4 14 6 BOB, 21 22 5 HEY Sender WASSUP? Recipient hahahaHAHAHAHA… Nosy Neighbor Hill Cipher Secure Hill Cipher Beforehand… Alice and Bob privately share matrix K, invertible over Zm To encrypt a matrix X over Zm… Compute Y = KX Send Y To decrypt Y… Compute X = K–1Y Beforehand… Alice and Bob privately share matrix K, invertible over Zm To encrypt a matrix X over Zm… Choose a vector t over Zm Form permutation matrix Pt Compute Kt = Pt–1KPt Compute Y = KtX and u = Kt Send (Y,u) To decrypt (Y,u)… Compute t = K–1u Compute Pt Compute Kt–1 = Pt–1K–1Pt Compute X = Kt–1Y Note that (Kt)–1 = (K–1)t Permutation Matrices I= 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Permutation Matrices I= 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 P23 = 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 Permutation Matrices I= 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 A permutation matrix is a matrix with exactly one 1 in each row and column and zeros elsewhere. P23 = P12,23 = 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 Permutation Matrices 1 0 P23 M 0 0 0 0 0 1 2 3 4 1 2 3 4 0 1 0 5 6 7 8 9 10 11 12 1 0 0 9 10 11 12 5 6 7 8 0 0 1 13 14 15 16 13 14 15 16 0 0 P12,23 M 1 0 1 0 0 1 2 3 4 5 6 7 8 0 1 0 5 6 7 8 9 10 11 12 0 0 0 9 10 11 12 1 2 3 4 0 0 1 13 14 15 16 13 14 15 16 Vector Representation P23 = P12,23 = 1 0 0 0 0 1 0 0 1 3 0 1 0 0 2 0 0 0 1 4 0 0 1 0 0 1 0 0 2 3 1 0 0 0 1 0 0 0 1 4 Hill Cipher Secure Hill Cipher Beforehand… Alice and Bob privately share matrix K, invertible over Zm To encrypt a matrix X over Zm… Compute Y = KX Send Y To decrypt Y… Compute X = K–1Y Beforehand… Alice and Bob privately share matrix K, invertible over Zm To encrypt a matrix X over Zm… Choose a vector t over Zm Form permutation matrix Pt Compute Kt = Pt–1KPt Compute Y = KtX and u = Kt Send (Y,u) To decrypt (Y,u)… Compute t = K–1u Compute Pt Compute Kt–1 = Pt–1K–1Pt Compute X = Kt–1Y The Easy Way to Encrypt Require t to be the vector representation of a permutation matrix N.B.: This is for example only—it is not practical “in the field.” An Example “Hey Bob, wassup?” 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 An Example Choose a permutation vector: 3 t 1 2 3 rows, since K is 3×3 Form permutation matrix Pt: 0 0 1 Pt 1 0 0 0 1 0 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 An Example Find Pt–1: 0 1 0 1 Pt 0 0 1 1 0 0 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 Compute Kt = Pt–1KPt : 0 1 0 11 23 10 0 0 1 Kt 0 0 1 16 19 24 1 0 0 1 0 0 20 4 23 0 1 0 An Example Find Pt–1: 0 1 0 1 Pt 0 0 1 1 0 0 Compute Kt = Pt–1KPt : 19 24 16 K t 4 23 20 23 10 11 Permutation of K 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 An Example Compute Y = KtX: 19 24 16 7 1 22 18 Y 4 23 20 4 14 0 20 23 10 11 24 1 18 15 Compute u = Kt: 11 23 10 3 u 16 19 24 1 20 4 23 2 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 19 24 16 K t 4 23 20 23 10 11 An Example Compute Y = KtX: 15 7 4 22 Y 2 8 6 0 23 18 2 25 Compute u = Kt: 24 u 11 6 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 19 24 16 K t 4 23 20 23 10 11 An Example Send (Y,u) to Bob 7 1 22 18 X 4 14 0 20 24 1 18 15 11 23 10 K 16 19 24 20 4 23 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 19 24 16 K t 4 23 20 23 10 11 15 7 4 22 Y 2 8 6 0 23 18 2 25 24 u 11 6 The Scenario 24 15 7 4 22 Y 2 8 6 0 u 11 6 23 18 2 25 Sender Recipient Nosy Neighbor The Scenario 24 15 7 4 22 Y 2 8 6 0 u 11 6 23 18 2 25 Sender Recipient Nosy Neighbor The Scenario 24 15 7 4 22 Y 2 8 6 0 u 11 6 23 18 2 25 Sender Recipient Nosy Neighbor The Scenario 24 15 7 4 22 Y 2 8 6 0 u 11 6 23 18 2 25 Sender Recipient Nosy Neighbor An Example 11 23 10 K 16 19 24 20 4 23 Receive (Y,u): 15 7 4 22 Y 2 8 6 0 23 18 2 25 24 u 11 6 An Example Compute K–1: 15 25 16 K 1 14 5 0 6 0 11 15 7 4 22 Y 2 8 6 0 23 18 2 25 11 23 10 K 16 19 24 20 4 23 24 u 11 6 Compute t = K–1u and derive Pt: 15 25 16 24 3 0 0 1 t 14 5 0 11 1 Pt 1 0 0 6 0 11 6 2 0 1 0 An Example Compute Kt–1 = Pt–1K–1Pt: 5 0 14 1 K t 0 11 6 25 16 15 Compute X = Kt–1Y: 5 0 14 15 7 4 22 X 0 11 6 2 8 6 0 25 16 15 23 18 2 25 15 7 4 22 Y 2 8 6 0 23 18 2 25 11 23 10 K 16 19 24 20 4 23 24 u 11 6 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 An Example Compute Kt–1 = Pt–1K–1Pt: 5 0 14 1 K t 0 11 6 25 16 15 Compute X = Kt–1Y: 7 1 22 18 X 4 14 0 20 24 1 18 15 “Hey Bob, wassup?” 15 7 4 22 Y 2 8 6 0 23 18 2 25 11 23 10 K 16 19 24 20 4 23 24 u 11 6 3 0 0 1 t 1 Pt 1 0 0 2 0 1 0 An Example But that was just a regular Hill cipher with a fancy key… The Actual Really Secure Hill Cipher Jeff Overbey MA464-01 • Dr. Jerzy Wojdyło • April 29, 2003 Based on S. Saeednia. How to Make the Hill Cipher Secure. Cryptologia 24 (2000) 353–360. The Actual Really Secure Hill Cipher or How to Secure the Secure Hill Cipher Ensuring Security X should have two columns Why? Suppose K is n × n and X is n × s. If s n… If 2 < s < n… If s = 2… Pt should be different for each encryption Theoretically, this can be ensured by choosing a different t for each encryption We did this by requiring t to be a vector representation of a permutation matrix, but this is not the best solution. The Function Let n denote the set of n × n permutation matrices. : Zmn n Ideally, is onto is 1-1 The Function Let n denote the set of n × n permutation matrices. : Zmn n Is it possible? Zmn = mn n = n! Zmn n An “ideal” function DNE. y = 26n y = n! The Function Ideas? Awkward silence… Apologies for the horrible background image pun. Apologies for the horrible background image pun.
© Copyright 2026 Paperzz