Fast exponentiation using binary representation of exponent.