Cryptographic system with modular randomization of exponentiation