# Affine Cipher Properties.

• Apr 29th 2012, 04:27 PM
Affine Cipher Properties.
I was working on a problem with an affine cipher. Looking at the properties they say for "f(x)=(ax + b)MOD26 defines a valid affine cipher if a is relatively prime to 26, and b is an integer between 0 and 25."

i was working with f(x)=-9x+12(mod26),so K=A, H=B... but f(x)=11x-170(mod26) gives the same answers but 170 isn't between 0 and 25?

Can someone explain this?
• Apr 29th 2012, 06:51 PM
MrCryptoPrime
Re: Affine Cipher Properties.
Actually, I don't think they yield the same answer?

Let's say for both functions that x=1, where modulus = "%".

(-9*1+12) % 26 = 3%26 = 3
(11*1-170) % 26 = -159%26 = 23

The variable "b" is the magnitude of shift in your cipher, so shifting 170 is equivalent to 14 since there are only 26 letters. It doesn't make much sense to shift beyond 25 as it just requires more work to encrypt and decrypt and does not add any additional cryptographic security. Since you always mod by 26 I don't see why you can't have b>25, it just seems redundant? (unless there's some mathematical principle that requires this to be true, but all I can tell is that a must be relatively prime to m or else you cannot decrypt) Hope that helps.
• Apr 30th 2012, 12:27 PM