Montgomery multiplication and modular exponentiation for crypto implementation