哪位高手帮我用java实现一下这段PB的加密解密方法,非常感谢!
下面这段代码为PB代码,是实现密码加密和解密的。小弟现在需要用java来实现!哪位高手帮忙一下。非常感谢!
string ls_lockpasswd,ls_unlockpasswd,ls_returnpasswd,ls_tmppwd
string ls_serialno[],ls_tmpserialno,ls_run
int li_i,li_j,li_time,li_pwdlen,li_partpwdlen
string ls_mod = '!'
//vs_passwd='ABCDEF'
if lower(vs_runway) = 'lock' then //给可见密码加密变为隐形密码
li_pwdlen = len(vs_passwd)
if li_pwdlen < 1 or isnull(vs_passwd) then
messagebox('提示','传入错误的可见密码!')
return '-1'
end if
if mod(li_pwdlen,2) <> 0 then
ls_mod = '^'
vs_passwd = ls_mod + vs_passwd
li_pwdlen = len(vs_passwd)
end if
li_partpwdlen = 0.5*li_pwdlen
//1.随机产生n位的序列号码
li_j = 1
do while li_j <= 144
ls_serialno[li_j] = ''
li_i = 1
ls_run = 'T'
do while li_i <= li_pwdlen
do while ls_run = 'T'
ls_tmpserialno = char(64+Rand(li_pwdlen))
if pos(ls_serialno[li_j],ls_tmpserialno) > 0 then
ls_run = 'T'
else
ls_run = 'F'
end if
loop
ls_serialno[li_j] = ls_serialno[li_j]+ls_tmpserialno
li_i = li_i + 1
ls_run = 'T'
loop
li_j = li_j + 1
loop
li_time =integer(mid(string(now(),'hh:mm:ss'),1,2)) +integer(mid(string(now(),'hh:mm:ss'),4,2))+integer(mid(string(now(),'hh:mm:ss'),7,2))
if li_time = 0 then
li_time = rand(144)
end if
//ls_serialno[li_time]='645231'
//2.按随机产生n位的序列号码给可见密码重新排序
li_i = 1
ls_tmppwd=''
do while li_i <= li_pwdlen
ls_tmppwd=ls_tmppwd+mid(ls_serialno[li_time],li_i,1)+mid(vs_passwd,asc(mid(ls_serialno[li_time],li_i,1))- 64,1)
li_i = li_i +1
loop
//ls_tmppwd='3C4D1A2B6F5E'
ls_lockpasswd=''
if mod(asc(mid(ls_tmppwd,1,1)), 2 ) = 0 then
li_i = 1
do while li_i <= li_partpwdlen
//one=one+two
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+1,1))+asc(mid(ls_tmppwd,(li_i - 1)*4+2,1))),3)
//two=two
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+2,1))),3)
//three=three
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+3,1))),3)
//four=three+four
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+3,1))+asc(mid(ls_tmppwd,(li_i - 1)*4+4,1))),3)
li_i= li_i + 1
loop
else
li_i = 1
do while li_i <= li_partpwdlen
//one=one改到这里201211221809
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+1,1))),3)
//two=one+two
ls_lockpasswd=ls_lockpasswd+right('000'+string(asc(mid(ls_tmppwd,(li_i - 1)*4+1,1))+asc(mid(ls_tmppwd,(li_i - 1)*4+2,1))),3)