-忘了摘自何处
【程序编程相关:C#使用CDO发送邮件】 【推荐阅读:【JSF心得】JAVA的对象传递是引用传】´ rsa加密算法在vb中的实现 【扩展信息:排序算法小结】public key(1 to 3) as long
private const base64 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst uvwxyz0123456789+/"public sub genkey()
dim d as long, phi as long, e as long dim m as long, x as long, q as long dim p as long randomize on error goto top top: p = rnd * 1000 \ 1 if isprime(p) = false then goto top sel_q: q = rnd * 1000 \ 1 if isprime(q) = false then goto sel_q n = p * q \ 1 phi = (p - 1) * (q - 1) \ 1 d = rnd * n \ 1 if d = 0 or n = 0 or d = 1 then goto top e = euler(phi, d) if e = 0 or e = 1 then goto topx = mult(255, e, n)
if not mult(x, d, n) = 255 then doevents goto top elseif mult(x, d, n) = 255 then key(1) = e key(2) = d key(3) = n end if end subprivate function euler(byval a as long, byval b as long) as long
on error goto error2 r1 = a: r = b p1 = 0: p = 1 q1 = 2: q = 0 n = -1 do until r = 0 r2 = r1: r1 = r ... 下一页