Fixed naive modular exponentiation, added key exchange and stream generation functions