加法 BN_Add
输入:a,b
输出:c=a+b
1.
c=0
2.
for i=0 up to RSA BNwordlen
2.1
carry=a[i]+b[i]+carry
2.2
c[i]=(word)carry
2.3
carry=carry>>32
3.
end for
4.
c[i]=carry
5.
return
乘法
输入:a,b
a=am…a0,b=bn…b0
输出:c=a*b
1.
c=0
2.
carry=0
unsigned int 64
3.
for i=0 up to m
3.1 for j=0 up to n
3.1.1 carry=carry+ai*bj
3.1.2 c[i+j]=(word)carry+Ci+j
3.1.3 carry=carry>>32
3.2 end for
4.
end for
5.
return c
上面是二进制数的加法和除法的算法,我没看懂,请高人指点一下哦,越详细越好。谢谢啦!