注册 登录
编程论坛 PowerBuilder

谁能帮看下MD5的算法

micrealhare 发布于 2010-04-22 01:38, 988 次点击
//Public function gf_check_reg (none) returns integer
string disksn
string ls_reg
string ls_realcode
string ls_id
long ll_count
string instr
string outstr
boolean r


outstr = space(100)
disksn = space(100)
getdisksn(0,disksn)
ls_id = trim(disksn)
select code INTO :ls_reg from G_reg where diskid =:ls_id  USING sqlca;
IF isnull(ls_reg) THEN ls_reg = ""
IF ls_reg = "" THEN RETURN 0
ls_reg = trim(ls_reg)
instr = trim(disksn)
r = md5string(instr,len(instr),outstr,100)
ls_realcode = left(trim(outstr),10)
IF r = TRUE THEN //11
    IF ls_reg = ls_realcode THEN //12
        RETURN 1
    ELSE //12
        RETURN 0
    END IF //12
ELSE //11
    RETURN 0
END IF //11
RETURN 0
输入:WD-WCAT16302971
得出:D1CA14C9DF
1 回复
#2
yumh19872010-04-23 14:11
顶起,小弟不会这个。。。。
1