Affine Ciphers

Affine ciphers are generalized and slightly strengthened from the shift ciphers. The key for the affine ciphers encryption process is a pair of 2 numbers (alpha, beta), with the equation

alpha*x + beta (mod 26)

Where
alpha has to satisfy the greatest common divisor of alpha and 26 has to be 1, gcd(alpha, 26)=1, which means alpha and 26 has to be relatively prime. This resulted in 12 possible choices for alpha, and they are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, and 25

beta has 26 choices between 0 and 25 inclusive because we are working with mod 26

Therefore, there are 12*26=312 choices for the key.

For example, let
alpha=5
beta=2

So, we are working on 5x + 2. Take a plaintext letter such as A(=0), it is encrypted to 5*0 + 2 (mod 26) which gives 2 the letter C

plaintext : AFFINE
ciphertext: CBBQPW

Number and Letter reference:
0 a
1 b
2 c
3 d
4 e
5 f
6 g
7 h
8 i
9 j
10 k
11 l
12 m
13 n
14 o
15 p
16 q
17 r
18 s
19 t
20 u
21 v
22 w
23 x
24 y
25 z

Search within Codexpedia

Custom Search

Search the entire web

Custom Search