Jump to content

Montgomery reduction: Difference between revisions

m
(→‎{{header|Tcl}}: added zkl)
Line 316:
fcn montgomeryReduce(modulus,T){
_assert_(modulus.isOdd);
bits:=modulus.len(2);
a:=BN(T); // we'll do in place math
do(modulus.len(2)){ // bits needed to hold modulus
foreach i in (bits){
if(a.isOdd) a.add(modulus);
a.div(2); // a>>=1
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.