Python code for math based cryptography class.