ModPow with bitshift implemented.