[python]Check if randomly generated number is a prime with decorator

In this script a random number is generated, before the number is passed the number is checked if it is a prime number if it is then the number is passed. I can either do this with calling a function that checks for prime number validity or use a decorator. A decorator is a function … Continue reading [python]Check if randomly generated number is a prime with decorator

[python]ASCII to integer and vice versa

There are two functions in python which can convert the ascii to the integer equivalent and vice versa. To convert ascii character to integer representation use ord(), to convert integer to ascii representation use chr(). Example: Result [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33] hello world!

[python]RSA mathematics learning tool

I wrote this script to teach myself on how to do RSA key generation (public key e and private key d), and how to encrypt and decrypt message mathematically. This tool will also be used as a refresher if I have forgotten how to calculate the RSA mathematics. This learning tool presents how the Euclidean … Continue reading [python]RSA mathematics learning tool

[python]Extended Euclidean Algorithm

I took my exam last night, and I guessed I would fail as I did not know how to calculate extended Euclidean Algorithm required for RSA. I came across this video, which explained eGCD really well, better than the slides I had and the tutor's explanation, the substitution method explained by my tutor was confusing. … Continue reading [python]Extended Euclidean Algorithm

[python] Diffie Hellman key exchange demo…

Ok, I was studying my examination and I was directed to watch this video to understand how Diffie Hellman (DH) key exchange works mathematically, the video was really good, concise and easy to understand, so to add spice to my study (study for examination is the world's most boring thing to do) I wrote a … Continue reading [python] Diffie Hellman key exchange demo…