You are on page 1of 7

‫استاذ المادة‬

‫أ‪.‬م‪.‬د‪.‬اخالص عباس البحراني‬


Example 1
 We shall encrypt the plaintext message "short example" using the
keyword “hill”
𝐻 𝐼
 First: The keyword written as a matrix. 𝐿 𝐿
 The key matrix (each letter of the keyword is converted to a number).
7 8
11 11
 The plaintext "short example" split into column vectors.
𝑠 𝑜 𝑡 𝑥 𝑚 𝑙
 ℎ 𝑟 𝑒 𝑎 𝑝 𝑒
 The plaintext converted into numeric column vectors
18 14 19 23 12 11
 7 17 4 0 15 4
Encryption process
 We multiply the key matrix by each column vector in turn.
𝟕 𝟖 𝒔 𝟕 𝟖 𝟏𝟖
 𝟏𝟏 𝟏𝟏 𝒉
= 𝟏𝟏 𝟏𝟏 𝟕
𝟕×𝟏𝟖 + 𝟖×𝟕 𝟏𝟐𝟖 𝟏𝟐𝟖 𝟎 𝑨
 = 𝟏𝟏×𝟏𝟖 +𝟏𝟏×𝟕
= 𝟐𝟕𝟓
= 𝟐𝟕𝟓
𝒎𝒐𝒅 𝟐𝟔 = 𝟏𝟓
= 𝑷
𝟕 𝟖 𝒐 𝟕 𝟖 𝟏𝟒
 𝟏𝟏 𝟏𝟏 𝒓
= 𝟏𝟏 𝟏𝟏 𝟏𝟕
𝟕×𝟏𝟒+𝟖×𝟏𝟕 𝟐𝟒𝟑 𝟐𝟒𝟑 𝟎 𝑨
 = 𝟏𝟏×𝟏𝟒+𝟏𝟏×𝟏𝟕
= 𝟑𝟒𝟏
= 𝟑𝟒𝟏
𝒎𝒐𝒅 𝟐𝟔 = 𝟑
= 𝑫
𝟕 𝟖 𝒕 𝟕 𝟖 𝟏𝟗
 𝟏𝟏 𝟏𝟏 𝒆
= 𝟏𝟏 𝟏𝟏 𝟒
𝟕×𝟏𝟗 + 𝟖×𝟒 𝟏𝟔𝟓 𝟏𝟔𝟓 𝟗 𝑱
 = 𝟏𝟏×𝟏𝟗+𝟏𝟏×𝟒
= 𝟐𝟓𝟑
= 𝟐𝟓𝟑
𝒎𝒐𝒅 𝟐𝟔 = 𝟏𝟗
= 𝑻
Cont…
𝟕 𝟖 𝑥 𝟕 𝟖 𝟐𝟑
 𝟏𝟏 𝟏𝟏 𝑎
= 𝟏𝟏 𝟏𝟏 𝟎
𝟕×𝟐𝟑 + 𝟖×𝟎 𝟏𝟔𝟏 𝟏𝟔𝟏 𝟓 𝑭
 = 𝟏𝟏×𝟐𝟑 + 𝟏𝟏×𝟎
= 𝟐𝟓𝟑
= 𝟐𝟓𝟑
𝒎𝒐𝒅 𝟐𝟔 = 𝟏𝟗
= 𝑻
𝟕 𝟖 𝒎 𝟕 𝟖 𝟏𝟐
 𝟏𝟏 𝟏𝟏 𝒑
= 𝟏𝟏 𝟏𝟏 𝟏𝟓
𝟕×𝟏𝟐 + 𝟖×𝟏𝟓 𝟐𝟎𝟒 𝟐𝟎𝟒 𝟐𝟐 𝑾
 = 𝟏𝟏×𝟏𝟐 + 𝟏𝟏×𝟏𝟓
= 𝟐𝟗𝟕
= 𝟐𝟗𝟕
𝒎𝒐𝒅 𝟐𝟔 = 𝟏𝟏
= 𝑳
𝟕 𝟖 𝒍 𝟕 𝟖 𝟏𝟏
 𝟏𝟏 𝟏𝟏 𝒆
= 𝟏𝟏 𝟏𝟏 𝟒
𝟕×𝟏𝟏 + 𝟖×𝟒 𝟏𝟎𝟗 𝟏𝟎𝟗 𝟓 𝑭
 = 𝟏𝟏×𝟏𝟏 + 𝟏𝟏×𝟒
= 𝟏𝟔𝟓
= 𝟏𝟔𝟓
𝒎𝒐𝒅 𝟐𝟔 = 𝟗
= 𝑱
 This gives us a final ciphertext of "APADJ TFTWLFJ".
Decryption process
 Step 1: Find the Multiplicative Inverse of the Determinant
 Calculating the determinant of our 2 x 2 key matrix.
𝟕 𝟖
 𝟏𝟏 𝟏𝟏
= 𝟕 × 𝟏𝟏 − 𝟖 × 𝟏𝟏 = −𝟏𝟏 𝒎𝒐𝒅 𝟐𝟔 = 𝟏𝟓
 The multiplicative inverse is the number we multiply 15 by to get 1 modulo
26.
 𝟏𝟓 × 𝟕 = 𝟏𝟎𝟓 𝒎𝒐𝒅 𝟐𝟔 = 𝟏
 So the multiplicative inverse of the determinant modulo 26 is “7”
 Step 2: Find the Adjugate Matrix
 The adjugate matrix of the key matrix.
𝟕 𝟖 𝟏𝟏 −𝟖 𝟏𝟏 −𝟖 𝟏𝟏 𝟏𝟖
adj 𝟏𝟏 𝟏𝟏
= −𝟏𝟏 𝟕
= −𝟏𝟏 𝟕
𝐦𝐨𝐝 𝟐𝟔 = 𝟏𝟓 𝟕
 Step 3 : Multiply the Multiplicative Inverse of the Determinant by the
Adjugate Matrix
 Multiplying the multiplicative inverse of the determinant by the adjugate
to get the inverse key matrix.
𝟏𝟏 𝟏𝟖 𝟕𝟕 𝟏𝟐𝟔 𝟐𝟓 𝟐𝟐
 𝟕× 𝟏𝟓 𝟕
= 𝟏𝟔𝟓 𝟒𝟗
mod 26= 𝟏 𝟐𝟑
𝟕 𝟖 −𝟏 𝟐𝟓 𝟐𝟐
𝒊𝒇 𝒌 = 𝟏𝟏 𝟏𝟏
, 𝒕𝒉𝒆𝒏 𝒌 = 𝟏 𝟐𝟑
 We multiply the invers key matrix by each column vector in turn
𝟐𝟓 𝟐𝟐 𝑨 𝟐𝟓 𝟐𝟐 𝟎
 𝟏 𝟐𝟑 𝑷
= 𝟏 𝟐𝟑 𝟏𝟓
25×0 + 22×15 330 330 18 𝑠
 = 1×0 + 23×15
= 345
= 345
𝑚𝑜𝑑26 = 7
= ℎ
𝟐𝟓 𝟐𝟐 𝑨 𝟐𝟓 𝟐𝟐 𝟎
 𝟏 𝟐𝟑 𝑫
= 𝟏 𝟐𝟑 𝟑
25×0 + 22×3 66 66 14 𝑜
 = 1×0 + 23×3
= 69
= 69
𝑚𝑜𝑑26 = 17
= 𝑟
Cont…
𝟐𝟓 𝟐𝟐 𝑱 𝟐𝟓 𝟐𝟐 𝟗
 𝟏 𝟐𝟑 𝑻
= 𝟏 𝟐𝟑 𝟏𝟗
25×9 + 22×19 643 643 19 𝑡
 = 1×9 + 23×19
= 446
= 446
𝑚𝑜𝑑26 = 4
= 𝑒
𝟐𝟓 𝟐𝟐 𝐹 𝟐𝟓 𝟐𝟐 𝟓
 𝟏 𝟐𝟑 𝑇
= 𝟏 𝟐𝟑 𝟏𝟗
25×5 + 22×19 543 543 23 𝑥
 = 1×5 + 23×19
= 442
= 442
𝑚𝑜𝑑26 = 0
= 𝑎
𝟐𝟓 𝟐𝟐 𝑊 𝟐𝟓 𝟐𝟐 𝟐𝟐
 𝟏 𝟐𝟑 𝐿
= 𝟏 𝟐𝟑 𝟏𝟏
25×22 + 22×11 792 792 12 𝑚
 = 1×22 + 23×11
= 275
= 275
𝑚𝑜𝑑26 = 15
= 𝑝
𝟐𝟓 𝟐𝟐 𝐹 𝟐𝟓 𝟐𝟐 𝟓
 𝟏 𝟐𝟑 𝐽
= 𝟏 𝟐𝟑 𝟗
 = 25×5 + 22×9
1×5 + 23×9
= 323
212
= 323
212
𝑚𝑜𝑑26 = 11
4
= 𝑙
𝑒
 We get back our plaintext of "short example"

You might also like