Home > College Algebra > Ciphers > Hill Cipher example

18. Hill Cipher example ( Enter your problem )
  1. Examples
Other related methods
  1. A1Z26 Cipher (Letter to number Cipher)
  2. ADFGVX Cipher
  3. ADFGX Cipher
  4. Affine Cipher
  5. Alberti Cipher
  6. Atbash Cipher
  7. Autokey Cipher / Autoclave Cipher
  8. Bacon Cipher
  9. Beaufort Cipher
  10. Bifid Cipher
  11. Caesar Cipher / Additive cipher / Shift Cipher
  12. Chaocipher
  13. Columnar transposition Cipher
  14. Double Transposition Cipher
  15. Enigma machine Cipher
  16. Four Square Cipher
  17. Gronsfeld Cipher
  18. Hill Cipher
  19. Kamasutra Cipher / Vatsyayana Cipher
  20. Morse Code Translator
  21. Multiplicative Cipher / Decimation Cipher
  22. Nihilist Cipher
  23. Playfair Cipher
  24. Polybius Square Cipher
  25. Porta Cipher
  26. Rail fence Cipher
  27. ROT-5 Cipher
  28. ROT-13 Cipher
  29. ROT-18 Cipher
  30. ROT-47 Cipher
  31. ROT-N Cipher
  32. Running Key Cipher
  33. Substitution Cipher
  34. Tap code Cipher / Knock code Cipher
  35. Three Square Cipher
  36. Trifid Cipher
  37. Trithemius Cipher
  38. Two-square Cipher
  39. Vigenere Cipher

17. Gronsfeld Cipher
(Previous method)
19. Kamasutra Cipher / Vatsyayana Cipher
(Next method)

1. Examples





1. Hill Cipher encoder

Text : ABCD efghi
KeyMatrix : 2,3;5,7
Padding Character : z


Solution:
The Hill cipher is a polygraphic substitution cipher that uses linear algebra and matrix multiplication for encryption

Letterabcdefghijklmnopqrstuvwxyz
Number012345678910111213141516171819202122232425

KeyMatrix = 2,3;5,7
Plaintext = abcdefghi
Split into pairs of 2-letters
ab cd ef gh i

Pad at end if necessary, to make pair of 2-letters
ab cd ef gh iz

23
57
`xx`
a
b
=
23
57
`xx`
0
1
=
3
7
mod 26=
3
7
=
d
h


23
57
`xx`
c
d
=
23
57
`xx`
2
3
=
13
31
mod 26=
13
5
=
n
f


23
57
`xx`
e
f
=
23
57
`xx`
4
5
=
23
55
mod 26=
23
3
=
x
d


23
57
`xx`
g
h
=
23
57
`xx`
6
7
=
33
79
mod 26=
7
1
=
h
b


23
57
`xx`
i
z
=
23
57
`xx`
8
25
=
91
215
mod 26=
13
7
=
n
h


Plaintext : abcdefghiz
Ciphertext : dhnfxdhbnh

2. Hill Cipher encoder

Text : hello world
KeyMatrix : 2,3;5,7
Padding Character : z


Solution:
The Hill cipher is a polygraphic substitution cipher that uses linear algebra and matrix multiplication for encryption

Letterabcdefghijklmnopqrstuvwxyz
Number012345678910111213141516171819202122232425

KeyMatrix = 2,3;5,7
Plaintext = helloworld
Split into pairs of 2-letters
he ll ow or ld

23
57
`xx`
h
e
=
23
57
`xx`
7
4
=
26
63
mod 26=
0
11
=
a
l


23
57
`xx`
l
l
=
23
57
`xx`
11
11
=
55
132
mod 26=
3
2
=
d
c


23
57
`xx`
o
w
=
23
57
`xx`
14
22
=
94
224
mod 26=
16
16
=
q
q


23
57
`xx`
o
r
=
23
57
`xx`
14
17
=
79
189
mod 26=
1
7
=
b
h


23
57
`xx`
l
d
=
23
57
`xx`
11
3
=
31
76
mod 26=
5
24
=
f
y


Plaintext : helloworld
Ciphertext : aldcqqbhfy





This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here



17. Gronsfeld Cipher
(Previous method)
19. Kamasutra Cipher / Vatsyayana Cipher
(Next method)





Share this solution or page with your friends.
 
 
Copyright © 2026. All rights reserved. Terms, Privacy
 
 

.