1. ## 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?

2. ## 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.

3. ## Re: Affine Cipher Properties.

does b have to be a multiple of a or anything like that?

4. ## Re: Affine Cipher Properties.

No, I don't think so. It is just an arbitrary constant that you add on to shift the ciphertext.

An affine cipher is really just a slightly more complex ceasar cipher, except the only thing you have (in a Caesar cipher) is "b", meaning that you shift everything (the alphabet) over b times. So if b=1, then in our alphabet we would have the following mappings: a=b, b=c, c=d....z=a. Hope that helps.