Showing posts with label RSA cryptosystem. Show all posts
Showing posts with label RSA cryptosystem. Show all posts

Thursday, January 23, 2020

RSA cryptosystem

RSA is an asymmetric system , which means that a key pair will be generated (we will see how soon) , a public key and a private key , obviously you keep your private key secure and pass around the public one.
The algorithm was published in the 70’s by Ron Rivest, Adi Shamir, and Leonard Adleman, hence RSA , and it sort of implement’s a trapdoor function such as Diffie’s one.
RSA is rather slow so it’s hardly used to encrypt data , more frequently it is used to encrypt and pass around symmetric keys which can actually deal with encryption at a faster speed.
We’ve got a message (“HELLO”) , and we’ve picked two tuples with two numbers each ( I will explain how these came about later). Obviously there’s no arithmetic operation we can perform with strings , so the message has to be convert it to something , so let’s say “HELLO” converts using some conversion algo to “2
Normally , in production , a lot of different techniques are used to encode the message and padding is also used
The interesting bit is how we come about those numbers , and how (5,14) is related to (11,14), and this is the interesting part i believe , let’s start:
The details of the Decryption/Encryption pair:
  1. Pick two prime numbers , I will pick 2 and 7 , lets call them p and q
P = 2 and Q = 7
2. Multiply P and Q , and that becomes the modulus
N = P * Q = 14
3. Make a list between 1 and 14 and remove the common factors: