# Answer to Question #16505 in C++ for syamil

Question #16505

Let the the encryption function be f(a)=(3a+9)mod 26 . Encrypt "STOP THIEF" using this function.?

Answer is NQBE QGJXA. But i cant understand how this answer comes. I cant understand the process of solving this problem and get this correct answer.Please help me and solve this problem in detail.

Answer is NQBE QGJXA. But i cant understand how this answer comes. I cant understand the process of solving this problem and get this correct answer.Please help me and solve this problem in detail.

Expert's answer

Assign numeric value to each letter of the alphabet:

A = 1 . . . . . H = 8 . . . . . . O = 15 . . . . . U = 21

B = 2 . . . . . I = 9 . . . . . . . P = 16 . . . . . V = 22

C = 3 . . . . . J = 10 . . . . . Q = 17 . . . . . W = 23

D = 4 . . . . . K = 11 . . . . . R = 18 . . . . . X = 24

E = 5 . . . . . L = 12 . . . . . S = 19 . . . . . Y = 25

F = 6 . . . . . M = 13 . . . . . T = 20 . . . . . Z = 26

G = 7 . . . . . N = 14

So in STOP THIEF, we get for each letter:

S = 19, f(19) = (3*19+9) mod 26 = 66 mod 26 = 14 = N

T= 20, f(20) = (3*20+9) mod 26 = 69 mod 26 = 17 = Q

O = 15, f(15) = (3*15+9) mod 26 = 54 mod 26 = 2 = B

P = 16, f(16) = (3*16+9) mod 26 = 57 mod 26 = 5 = E

T= 20, f(20) = (3*20+9) mod 26 = 69 mod 26 = 17 = Q

H = 8, f(8) = (3*8+9) mod 26 = 33 mod 26 = 7 = G

I = 9, f(9) = (3*9+9) mod 26 = 36 mod 26 = 10 = J

E = 5, f(5) = (3*5+9) mod 26 = 24 mod 26 = 24 = X

F = 6, f(6) = (3*6+9) mod 26 = 27 mod 26 = 1 = A

So "STOP THIEF" become "NQBE QGJXA"

A = 1 . . . . . H = 8 . . . . . . O = 15 . . . . . U = 21

B = 2 . . . . . I = 9 . . . . . . . P = 16 . . . . . V = 22

C = 3 . . . . . J = 10 . . . . . Q = 17 . . . . . W = 23

D = 4 . . . . . K = 11 . . . . . R = 18 . . . . . X = 24

E = 5 . . . . . L = 12 . . . . . S = 19 . . . . . Y = 25

F = 6 . . . . . M = 13 . . . . . T = 20 . . . . . Z = 26

G = 7 . . . . . N = 14

So in STOP THIEF, we get for each letter:

S = 19, f(19) = (3*19+9) mod 26 = 66 mod 26 = 14 = N

T= 20, f(20) = (3*20+9) mod 26 = 69 mod 26 = 17 = Q

O = 15, f(15) = (3*15+9) mod 26 = 54 mod 26 = 2 = B

P = 16, f(16) = (3*16+9) mod 26 = 57 mod 26 = 5 = E

T= 20, f(20) = (3*20+9) mod 26 = 69 mod 26 = 17 = Q

H = 8, f(8) = (3*8+9) mod 26 = 33 mod 26 = 7 = G

I = 9, f(9) = (3*9+9) mod 26 = 36 mod 26 = 10 = J

E = 5, f(5) = (3*5+9) mod 26 = 24 mod 26 = 24 = X

F = 6, f(6) = (3*6+9) mod 26 = 27 mod 26 = 1 = A

So "STOP THIEF" become "NQBE QGJXA"

## Comments

## Leave a comment