The Affine cipher uses a mathematical formula to encrypt, such as for a linear equation of \(E(x) = (a x + b)\). If we use a 26 letter alphabet the operation becomes \(E(x) = (a x + b) \mod 26\), where x is the character to encrypt, and a and b are constants that are kept secret. Using the a and b values given, create the following Affine cipher codes:
The Affine Cipher |
Theory
If we try a=5, b=8, and use lower case characters, we get:
Message: affine Type: affine-?l-5,8 Likely methods: {('base40-generic',): '?b\n&'} Encoding: 'ihhwvc' Hex: 696868777663
The mapping is:
a (1) -> 1*5+8 (mod 26) -> 4 (e) f (5) -> 5*5+8 (mod 26) -> 7 (h) i (8) -> 8*5+8 (mod 26) -> 22 (w) n (13) -> 13*5+8 (mod 26) -> 21 (v) e (4) -> 4*5+8 (mod 26) -> 2 (c)
The mapping of the letter is:
a 0 b 1 c 2 d 3 e 4 f 5 g 6 h 7 i 8 j 9 k 10 l 11 m 12 n 13 o 14 p 15 q 16 r 17 s 18 t 19 u 20 v 21 w 22 x 23 y 24 z 25