Thank you for this great package. I am definitely not a pro programmer but I wrote a little function because I needed something like powermod from the Matlab symbolic toolbox. I might have made mistakes, but it seemed a lot faster to use this to compute the modulo of a power.
function result = powermod(x,power,modulus)
intermediateResult = x;
flag = 1;
for i=1:32
intermediateResult = mod(intermediateResult^2,modulus);
if(bitget(power,i))
if(flag)
moduloResult = intermediateResult;
flag = 0;
else
moduloResult = moduloResult*intermediateResult;
end
end
end
result = mod(moduloResult,modulus);
end