RSA+Intro

RSA Introduction Public key cryptography got its first example from RSA, named for Rivest, Shamir and Adleman. Let's spend this week making baby examples of this type of encryption. Here's the procedure.

DO NOT CHOOSE THE SAME NUMBER FOR TWO DIFFERENT ROLES IN THE PROCEDURE! The instructor made a mistake in the original steps 1 through 6. It led to your inability to decode your own message. Since we're using such small numbers for the mod, every once in a while, the numbers work and we get the message back okay, BY COINCIDENCE! OUCH! Here are the steps, corrected, with the rest of your answers examined. user:mcdaniel30

Step 1. You select, but do not divulge, two distinct prime numbers. Call them P1, P2. Step 2. Multiply them. This product becomes public knowledge. Call this C1. Step 3. Subtract 1 from each prime and multiply, (P1 - 1)(P2-1) = **K**. Then select a number which is mutually prime with this number. Call this N1. Step 4. Write down the equation N1*m - **K** *y = 1 and find a solution. What do the m and y stand for?user:TrevorBarton With N1 and K mutually prime, there are an infinite number of integer solutions for m and y. These two numbers don't really STAND for anything. That N1m and Ky differ by 1 is crucial.

Your prep is done.

Step 5. Now create a small string of numbers to stand for your message. Your message must be smaller than C1. Step 6.Compute message^N1 mod C1. This is an RSA encrypted version of your original message.Call it M. Step 7. Compute M^m mod C1. This should be your original message. I have no idea how to do mods on my calc...user:TrevorBarton

Mods are cool. 14 mod 10 is 4. 25 mod 6 is 1. Mod p is just the remainder when divided by p. 14 = 10*2 +4 25 = 6*4 + 1 One of their coolest properties is, the mod of a product is the product of the mods. Example: Let's say we need 14^24 mod 17, on a calculator. 14^24 goes into scientific notation - no good for us. We can't use decimals in this method of encryption. So we bust 14^24 into bitesized portions. 14^7 = 105413504 105413504 = 6200794*17 + 6. I got the 6200794 from doing 1054135 / 17 = 6200794.mess on my calculator. All I want is the remainder as an integer, not a decimal. So I did that little subtraction problem.

Now, let's be clever. 14^24 = 14^7 * 14^7 * 14^7 * 14^3. I can get 14^3 = 7 mod17 the same way. 14^24 mod 17 = ((6 * 6 * 6) * 7) mod 17. Much easier. 6*6*6*7 = 1512 1512 / 17 = 88.mess 1512 - 88*17 = 16. SO, 14^24 mod 17 = 1512 mod17 = 16.

My example: p1=3, p2=5 , p1xp2=15 so c1=15 3-1=2 and 5-1=4, so 4x2 is 8 = K, my choice for the mutual prime is 7 = N1 Let the message be 12 7m- 8 y=1, so m= 15 and y=13 (weird that this 13 still worked. We could be in trouble with m = 15 = C1.) 12^7 mod15=3=M so M^m mod15 is 3^ 15 mod 15, which can be split up into (3^14 mod 15) x (3^1 mod 15) this is where it gets messy. 3^14 mod 15 is 9, so 9x3 mod 15 is 12, our original message. user:D_Sweeney

This process will get easier after you try it a few times. In real life, we'll use a computer command to get mods. But I think it is essential for us all to dig mods before we let the computer do all the heavy lifting. user:mcdaniel30

Our first few weeks of work will be exploring why this method of encryption works. If you keep your numbers small, you can do this on your calculator.

In actual RSA encryption, C1 and N1 are announced to the world. A little program runs the Steps 6 and 7. Then the program sends the encrypted message in the clear, across public access radio waves or over a wire or through a cable. Even if someone with C1 and N1 intercepts the message, decoding is difficult so long as C1 is tough to factor.

Problem 1. Make up an example. Show all numbers and calculations.

Here is my attempt, I am not getting the right message, but I can't see where I am going wrong. Maybe someone else can point it out. Anna made no mistake. She followed the mistake in the instructions perfectly. Here's the fix. Step 1: P1=2, P2=7 Step 2: P1*P2=14=C1 Step 3: (2-1)(7-1)=6 = K ; I chose 5 for N1, which is mutually prime with 6 Step 4: 5m - 6y =1 with sln m=5, y=4 Step 5: chose message=12 Step 6: 12^(5)*mod14=10=M Step 7: 10^( **5** )mod14= 12 twelve just like it's supposed to be 12 user:wrighann

Step 1: P1 = 7, P2 = 3 Step 2: 7 * 3 = 21 = C1 Step 3: 7-1 = 6 3-1 = 2 6 * 2 = 12 = K 5 is mutually prime with 12. N1 = 5 Step 4: N1 * m – 12 * y = 1 5m – 21y = 1 m = 29, y = 12 (I had to do these over for Laurauser:mcdaniel30) Step 5: Message is 19 Step 6: 19^5 mod 21 = 10 = M Step 7: 10^29 mod 21 10^29 = 10^9 * 10^9 *10^9 * 10^2 10^9 mod 21 = 13 10^2 mod 21 = 16 (13^3 * 16) mod 21 = 35152 mod 21 = 19 because 35152 - 1673*21 = 19. yay. user:LauraShuman

Alright, heres my attempt: 1) P1 = 5, P2 = 2 2) 5*2 = 10 = C1 3) (5 - 1)(2 - 1) = 4 N1 = 3 4) 3m - 10y = 1 m = 7, y =2 5) Message = 8 6) 8^3 mod 10 = 2 = M 7) 2^7 mod 10 = 8 Everything seemed to work fine... This is example is a coincidence and is worth saving for future study.user:mcdaniel30 user:MattJohnson1013

Problem 2. Who first proposed public key encryption and what does it have to do with Martin Gardner? Diffie and Hellman knew that the internet was coming and knew that there needed to be a new system to prevent eavesdropping and guarantee messages are legitimate. A paper they wrote suggested an idea that knowing the procedure does not imply knowing the inverse procedure(Public Key Encryption) Gardner published Rivest, Shamir, and Aldeman's (RSA) "Mathematical games" in his column in Scientific America, 1977.user:TrevorBarton Excellent, Trevor! If anyone is interested, Martin Garder received a court order to cease publication of letters regarding Diffie/Hellman's ideas. The NSA wanted to keep this method of encryption out of public usage until they had a chance to study it.user:mcdaniel30 Problem 3. Why is RSA considered less secure than it used to be? Math people have found a few new tricks for factoring large products. Also, computer speeds have gone crazy-high, giving probabilistic methods a shot at working. We'll see two of these later. Problem 4. What Maple commands would we need to write a program which would perform this encryption? Let's save this for week 3. Problem 5. Suppose someone used twin primes to make C1. How easy would it be to find P1 and P2? Take the square root of C1 and you would have the twin prime numbers P1 and P2 user:LauraShuman Yes, Laura. Almost. The square root would not be an integer. So please say a little more. user:mcdaniel30 So yes, the square root would not be an integer. One of the primes would be slightly smaller than the sqrt, and the other would be 2 higher than that. So the square root gives a middle ground to work from to find P1 and P2. user:LauraShuman