Affine Cipher I have been trying to s...

Affine Cipher I have been trying to solve for hours.

Posted in the Cryptography Forum

Staz

Auckland, New Zealand

#1 Jun 11, 2006
I know that E is encrypted to R and that V is encrypted to Q. But that is all I know!!:( I need to decrypt : FMMOVSR.

Oh, and originally, A = 0 B= 1 etc.. up to Z = 25

Please help out. It's Driving me crazy.
Thanks so much!
Not An Option

Oyster Bay, Australia

#2 Jun 11, 2006
solving 4a + b = 17 (mod 26) and 21a + b = 16 (mod 26) gives a = 3, b = 5. You can do the last step yourself, I'm sure, and then you're all done.
Cipher decode

New York, NY

#3 Jul 7, 2008
Can anyone explain how did he solved for a and b in detail . Thanks.
Jeff Dege

Cottage Grove, MN

#4 Jul 7, 2008
4*a + b = 17
21*a + b = 16

b = 17-4*a

21*a +(17-4*a)= 16

21*a + 17 - 4*a = 16
17*a + 17 = 16
17*a = 16-17 = 25 (Remember, it's mod-26)

And so we want to multiply by the multiplicative inverse of 4, mod-26.

23*17*a = 23*25
1*a = 3

a = 3

b = 17-4*a
b = 17 - 4*3
b = 5

The trick is that you can't divide, in modular arithmetic. Instead you multiply by the multiplicative inverse - which is the number that when multiplied by gives you 1.

The multiplicative inverse of 3 mod 26 is 9, because 3*9 = 27 = 1 mod 26.

Not every integer in modular arithmetic has a multiplicative inverse, only those that are relatively prime to the modulus. So mod 26, only the odd numbers other than 13 are prime. Numbers that are multiples of 2 or 13 are not relatively prime to 26, and thus do not have multiplicative inverses.

And hence, cannot be used as the multiplier in affine ciphers.

Which is why affine ciphers have a keyspace of 312 (12*26), instead of 676 (26*26). There are only 12 possible multipliers.
Anathema

Rochester, NY

#5 Sep 9, 2008
Jeff Dege wrote:
And so we want to multiply by the multiplicative inverse of 4, mod-26.
23*17*a = 23*25
I think you mean the inverse of 17, not 4.
dev

Jabalpur, India

#6 Oct 2, 2009
jhatu answer
Tkmax

Nottingham, UK

#7 Oct 31, 2009
Jeff Dege wrote:
4*a + b = 17
17*a = 16-17 = 25 (Remember, it's mod-26)
And so we want to multiply by the multiplicative inverse of 4, mod-26.
23*17*a = 23*25
1*a = 3
a = 3
can you please explain what happened to the 16-17 when working out "a", because in the formula,

it goes from 17*a = 16-17 = 25
to 23*17a = 23*25

Also where did the 23 and 25 come from.

Thanks in advance.
jdege

Minneapolis, MN

#8 Oct 31, 2009
All values, when working mod-26, are between 0 and 25. Numbers less than 0 or greater than 25 have 26 added or subtracted until the result is between 0 and 25.

17*a + 17 = 16 mod 26

First step is to subtract 17 from each side:

17*a = 16 - 17 mod 26

Now, 16 - 17 is -1, which is not between 0 and 25, so we add 26 to get us back in our range of mod-26 values.

-1 + 26 = 25

So:

17*a = 25 mod 26

Next step is to divide each side by 17:

a = 25/17 mod 26

The question is, what does division mean, when dealing with modular numbers? Just what it does with regular numbers - multiplication by the inverse.

a = 25 * 1/17 mod 26

And what is the multiplicative inverse of 17, mod 26? It's the number that when multiplied by 17, yields 1.

So:

23 * 17 = 391 = 26*15 + 1 = 1 mod 26

So:

1/17 = 23 mod 26

And:

a = 25 * 23 mod 26
Anomalous

UK

#9 Nov 1, 2009
Jeff Dege wrote:
And so we want to multiply by the multiplicative inverse of 4, mod-26.
23*17*a = 23*25
1*a = 3
a = 3
b = 17-4*a
b = 17 - 4*3
b = 5
how do you find this 23 number you multiply on each side of the equation??? And then how do you find 1*a = 3???
Anomalous

UK

#10 Nov 1, 2009
ignore my last message!!! I hadn't reload the page since yesterday and i didnt notice the last 2 comments!!!
jdege

Minneapolis, MN

#11 Nov 1, 2009
Actually, finding the multiplicative inverse of a number, in modular arithmetic, isn't easy. The available algorithms are a lot more expensive than long division.(And, of course, not all numbers have a multiplicative inverse, if the modulus isn't prime.)

http://en.wikipedia.org/wiki/Modular_multipli...

For relatively small modulos, like 26, the easiest thing to do is simply to create a multiplication table.
seccs

Pakistan

#12 Nov 19, 2009
how would i find {95}^1 to find multiplicative inverse for construction of s box in aes...plz reply
{95} is in hexa decimal
trellmix

United States

#13 Dec 8, 2009
Hey can anyone help me decipher the following affine........
Pjxfjswjnkjmrtjfvsujoojwfovajr wheofjrwjodjffzbjf
Almanak

Albania

#14 Dec 19, 2009
Hash and MAC Algorithms, can u help me telling anything about these terms(problems)?
Thank you so much
thanks

Orlando, FL

#15 Sep 1, 2010
Thanks for posting a bit about this topic-- I was working on a problem for my class, and I got lost reading my teacher's notes-- this helped out a lot.
must

Baghdad, Iraq

#16 Jan 21, 2013
decipher the following cryptogram glzoxa knowing that an affine cipher with k2=4 was used and that the plaintext is a word of the english language ? can any one help me to solve this equation
must

Iraq

#17 Jan 21, 2013
glzoxa is the cipher message ???
Bob

Southall, UK

#18 Jan 26, 2013
Using the formula c = 7p + 10 glzoxa deciphers as:

SPRING

Tell me when this thread is updated:

Subscribe Now Add to my Tracker

Add your comments below

Characters left: 4000

Please note by submitting this form you acknowledge that you have read the Terms of Service and the comment you are posting is in compliance with such terms. Be polite. Inappropriate posts may be removed by the moderator. Send us your feedback.

Cryptography Discussions

Title Updated Last By Comments
Generic Substitution Cipher Help (I think) Aug 12 Damein 1
Cube26A Cipher Aug 9 pvial00 1
Galaxy Cipher Instrument open sourced. Jul '17 Russell Lee 2
Simple cipher I made. Jul '17 Mysteryman 1
HELP! I need help decrypting this! Jun '17 Anon 1
Who can decode this cypher and how long did it ... Jun '17 bhouseman 1
Scroll Cipher Instrument-open sourced. Jun '17 Russell Lee 1
More from around the web