2012年2月18日

RSA Reloaded

摘要: pick two large (n-bit) random prime p and q.public key is (N,e) where N=pq and e is a (2n-bit) number relatively prime to (p-1)(q-1).A common choice is e =3 because it permits fast encoding.secret key is d, the inverse of e modulo (p-1)(q-1), computed using the extended euclid algorithm.Instances:pu 阅读全文

posted @ 2012-02-18 20:25 grepp 阅读(143) 评论(0) 推荐(0) 编辑

乘法的算法

摘要: 两种思路一个是Divide and conquer(recursive)另一个是binary 算法def multiply(x,y): if y ==0: return 0 z = multiply(x,y/2) if y%2 ==0: return 2*z else: return x +2*z#就是小时候学的叠罗汉的乘法#multiply2(x,y)def multiply2(x,Y): if(y==0): return 0 r = 0 while(x !=0): if(x%2 !=0 ): r +=y x = x/... 阅读全文

posted @ 2012-02-18 15:32 grepp 阅读(226) 评论(0) 推荐(0) 编辑

导航