An algorithm for modular exponentiation

The best known algorithm for modular exponentiation Me mod t for arbitrary M, e and t is of O(n3) where n is the number of bits in the largest of M, e and t. This paper presents an O(n2) algorithm for the problem where Me mod t is required for many values of M and e with constant t some preprocessing is done on t, and the results are applied repeatedly to different values of M and e. The main algorithm involves on-line arithmetic in a redundant. number system. An immediate application is in encoding/decoding of messages in an RSA-based public-key cryptosystem.