Efficient modular exponentiation algorithms in Python
eli.thegreenplace.net