首页
社区
课程
招聘
[求助]高手们看看这个PB加密函数的反函数怎么写?
发表于: 2013-11-23 18:57 3055

[求助]高手们看看这个PB加密函数的反函数怎么写?

2013-11-23 18:57
3055
//加密部分
Public function f_convert_c_to_h (string pwd_str) returns string
string pwd_str
integer li_asc
integer li_high
integer li_low
string ls_high
string ls_low

li_asc = asc(pwd_str)
li_low = mod(li_asc,16)
li_high = (li_asc - li_low) / 16
CHOOSE CASE li_high
        CASE 0,1,2,3,4,5,6,7,8,9
                ls_high = string(li_high)
        CASE 10
                ls_high = "A"
        CASE 11
                ls_high = "B"
        CASE 12
                ls_high = "C"
        CASE 13
                ls_high = "D"
        CASE 14
                ls_high = "E"
        CASE 15
                ls_high = "F"
END CHOOSE
CHOOSE CASE li_low
        CASE 0,1,2,3,4,5,6,7,8,9
                ls_low = string(li_low)
        CASE 10
                ls_low = "A"
        CASE 11
                ls_low = "B"
        CASE 12
                ls_low = "C"
        CASE 13
                ls_low = "D"
        CASE 14
                ls_low = "E"
        CASE 15
                ls_low = "F"
END CHOOSE
RETURN ls_high + ls_low

//加密函数
Public function f_encode_pwd_new (string as_pwd) returns string
string as_pwd
string ls_encrypt_pwd=""
integer li_len
integer i
integer li_sort[15] ={5,6,9,7,10,3,8,4,14,15,2,1,12,11,13}
char ls_sort[15] ={char(65),char(67),char(89),char(69),char(70),char(80),char(72),char(84),char(83),char(75),char(108),char(85),char(81),char(87),char(88)}
string ls_pwdstr[15]
string ls_temp="W37JXETHRDS4A6F"
string ls_encrypt_pwd_new

IF isnull(as_pwd) THEN as_pwd = ""
li_len = len(as_pwd)
IF li_len > 15 THEN
        li_len = 15
        as_pwd = left(as_pwd,15)
ELSEIF li_len < 15 THEN
        as_pwd = left(ls_temp,15 - li_len) + as_pwd
        li_len = 15
END IF
FOR i = 1 TO li_len
        ls_pwdstr[i] = f_convert_c_to_h(right(as_pwd,i)) NEXT
FOR i = 1 TO li_len
        ls_encrypt_pwd = ls_encrypt_pwd + ls_pwdstr[li_sort[i]]
NEXT
FOR i = 1 TO 5
        ls_encrypt_pwd_new = ls_encrypt_pwd_new + mid(ls_encrypt_pwd,5 * i - 4,5) + "-"
NEXT
ls_encrypt_pwd_new = ls_encrypt_pwd_new + mid(ls_encrypt_pwd,26,5)
RETURN ls_encrypt_pwd_new

其中加密函数f_encode_pwd_new为主函数,里面调用了转换函数f_convert_c_to_h;
求帮忙参考这个函数写出对应的反函数,谢谢各位!

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//