17 • Rotation Code

11K 85 19
                                    

Type: Substitution

(Note: it's formula forencryption is f(x)=(ax)mod26 and for decryption is f(y)=a^-1(y)mod26, where x or y corresponds to the position of the letter in the alphabet, e.g. a=0, b=1, c=2.....z=25, mod26 correspond to the limit of the rotation, and a correspond to any input number)



Example: (encryption)
Plaintext: KING
F(x)=(ax)mod26
a=2



K=10, f(x)=(2*10)mod26=20
�I =8,   f(x)=(2*8)mod26=16
N=13, f(x)=(2*13)mod26=26
G=6,   f(x)=(2*6)mod26=12



K=20=U
I =16=Q
N=26=A
G=12=M



Ciphertext: UQAM



Example: (decryption)
Ciphertext: UQAM
F(y)=a^-1(y)mod26
a=2



U=20, f(y)=2^-1(20)mod26=10
Q=16, f(y)=2^-1(16)mod26=8
A=26, f(y)=2^-1(26)mod26=13
M=12, f(y)=2^-1(12)mod26=6



U=10=K
Q=8=I
A=13=N
M=6=G



Plaintext: KING



(Note: mod26, when no>25,
then it will rotate back to 0, 26=0, 27=1, 28=2 and so on, where a=0 and z=25, e.g. 30=e)

Codes and CiphersWhere stories live. Discover now