随便写了一个,输入参数uid,pwd。
根据uid加密pwd,第一次调用加密,第二次调用解密。
比如:
string uid,pwd
uid = 'admin888'
pwd = '888admin'
pwd = gf_encryption(uid,pwd) //代入uid和pwd,返回加密了的pwd
messagebox(uid,pwd)
pwd = gf_encryption(uid,pwd) //代入uid和加密的pwd,返回解密的pwd
messagebox(uid,pwd)
=======================================================
global type gf_encryption from function_object
end type
forward prototypes
global function string gf_encryption (string uid, string pwd)
end prototypes
global function string gf_encryption (string uid, string pwd);
if isnull(uid) or uid = '' then return ''
if len(pwd) > 8 then return ''
if isnull(pwd) or pwd = '' then return ''
int encryptcode,i
String newpwd
char lc_uid[],lc_pwd[]
char c[]
encryptcode = 0
if isnull(uid) or uid = '' then return ''
if len(pwd) > 8 then return ''
if isnull(pwd) or pwd = '' then return ''
lc_uid = uid
lc_pwd = pwd
for i = 1 to len(uid)
encryptcode += asc(lc_uid[i])*i
next
for i = 1 to 8
c[i] = '0'
next
for i = 1 to len(pwd)
c[i] = char(156 - asc(lc_pwd[i]) + (mod(i*encryptcode + len(pwd),8)))
next
newpwd = ''
for i = 1 to len(pwd)
newpwd = newpwd + c[i]
next
return newpwd
end function
pb一次加密再次解密
最新推荐文章于 2020-10-17 21:01:03 发布