RSA Cryptography

Cryptography (how we keep messages secure) uses Mathematics and Prime Numbers in particular.

In essence it is a lot easier to multiply primes together than to work out what primes were multiplied to make a number.

Example: What is 101 × 131?

After a short while we can get the answer of 13231

But what if the question was "What are the prime factors of 13231?"

We might be working a long time on that question!

The same applies to computers but the numbers involved are much bigger.

sage with message

RSA

The RSA algorithm (named after its creators Rivest, Shamir and Adleman) relies on that idea.

It is a public-key / private-key encryption algorithm that uses prime numbers like this:

The public key encodes the message strongly.

But only the private key can decode it easily.

You can try it at RSA Interactive

Step by Step

Let's do the actual steps using some small numbers (but when used for secure communications the numbers are 100s of digits long).

Create Keys

We now have our keys:

Encode The Message

Our message is really simple: hi

Decode The Message

Wow, it works!

 

 *Unicode is a standard for turning characters (letters, numbers, punctuation, etc.) into numbers. In Unicode a=97, b=98, etc. You could use any system you want really, such as a=1, b=2, etc. 

 

25398, 25399, 25400, 25401, 25402