Let’s have a bit of fun with an easy crypto cipher.
Mallory and Eve are being watched by Trent for all the messages they send. But before Trent started watched them, Mallory came up with a secret plan. “Let’s use RSA encryption”, he said. “And where we take the names of the leaders of the US, Germany, UK, France and Italy and then pick two of them, and create an encryption key. As it is RSA, we will generate a prime number from each name, and then generate our encryption and decryption key.”. “Okay. I know that RSA takes two prime numbers, so how do we convert their names into a prime number?”, Eve injected. “It’s all about taking their names, and treating that as our random data, and then generating the prime number based on that. So this method looks good:”
String to prime
def generate_prime_from_string(s, size=None, k=25): """ Generate a pseudo-prime starting with s in string…
Now, as Trent watches their messages, Mallory and Eve need to arrange a secret meeting place in a capital city. And so Mallory sends a message of:
Which capital city will they meet in?
If you are stuck, here’s a helper program to do the basic RSA method [here].
If you want more ciphers challenges, try here: