How the RSA algorithm work

 RSA


The RSA algorithm is an asymmetric cryptography algorithm, this means that it uses a public key and a private key. These are their names. public key can be shared with anyone but the private key must be confidential.

Steps in RSA Algorithm

starting from creating the key pair, to encrypting and decrypting the information

Key Generation

We need to generate public and private keys before running the functions to generate we are ciphertext and plaintext. The use in certain variables and parameters

• Choose two large prime numbers (p and q)

• Calculate n = p*q and z = (p-1)(q-1)

• Choose a number e where 1 < e < z

• Calculate d = e-1mod(p-1)(q-1)

• You can bundle private key pair as (n,d)

• You can bundle public key pair as (n,e)

Encryption Function

Once generate the keys, you pass the parameters to the functions that calculate your ciphertext and plaintext using the respective key.

• If the plaintext is p, ciphertext = pe mod n.

Decryption Function

• If the ciphertext is c, plaintext = cd mod n




Post a Comment

0 Comments

Close Menu