Cyber Security

Luke Hally

RSA Practice

September 3, 2021
Categories:
Tags:

Now that we covered asymmetric cryptography and and how RSA works, there’s nothing like working through equations to understand them. So let’s do some practice RSA key generation. We’ll use small numbers for the examples so we can do it by hand, just to understand the equation.

Just a reminder from Asymmetric Cryptography on the functions and inputs.

EncryptDecrypt
where
x = plain text
e = encryption key
d = decryption key
n = modulus
y = cipher text

We were provided with p = 17; q = 19

KeepDestroy
n = 323
e = 11
d = 131
p, q, m

Practice Encryption

  • Given e = 7825 and n = 467323, encrypt the message ‘RSA’.
  • Convert RSA to number. a = 01, b = 02 … z = 26. RSA => 181901
  • y = xemod(n) =>1819017825mod(467323) = 183780
  • Cipher text: 183780 

Practice Decryption

  • Given d: 214833 and n = 467323 and cipher text = 183780
  • x = ydmod(n) => 183780214833mod(467323) = 181901
  • Plain text: RSA

Reflection

That was very cool, I’d forgotten that I was good at maths. That definitely came in handy, a fair few of my classmates were having issues with the maths.

If you need help with the calculations, WolframAlpha is a great tool.

Recent posts