What is the difference between LCG and Affine cipher?

More specific: What are they used for, and what are the structural differences between them?


A LCG -- linear congruential generator -- is used to generate a sequence of pseudorandom numbers. Therefore, it takes the previous output to calculate a new number:

yi = (a*yi-1+c) mod N

With an Affine cipher, in contrast, you can encrypt and decrypt. You can convert your text to a number; for example, character for character "A"->0 "B"->1... "Z"-> 25

To encrypt a message m you use the following formula:

c = (a*m + b) mod N


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy