An algorithmic and architectural study on Montgomery exponentiation in RNS