$PBExportHeader$nvo_md5.sru
$PBExportComments$md5加密对象
forward
global type nvo_md5 from nonvisualobject
end type
end forward

global type nvo_md5 from nonvisualobject
end type
global nvo_md5 nvo_md5

type variables
integer BITS_TO_A_BYTE = 8
integer BYTES_TO_A_WORD = 4
integer BITS_TO_A_WORD = 32

long il_lOnBits[0 to 30],il_l2Power[0 to 30]

 

end variables

forward prototypes
public function long uf_rshift (long ps_lvalue, long ps_ishiftbits)
public function long uf_RotateLeft (long ps_lValue, long ps_iShiftBits)
public subroutine uf_md5_hh (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac)
public subroutine uf_md5_ii (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac)
public subroutine uf_md5_gg (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac)
public function long uf_md5_i (long ps_x, long ps_y, long ps_z)
public function long uf_md5_h (long ps_x, long ps_y, long ps_z)
public function long uf_md5_g (long ps_x, long ps_y, long ps_z)
public function long uf_md5_f (long ps_x, long ps_y, long ps_z)
public function long uf_binary2long (string ps_binary)
public function long uf_lshift (long ps_lvalue, long ps_ishiftbits)
public function long uf_xor (long ps_num1, long ps_num2)
public function unsignedlong uf_or (unsignedlong ps_num1, unsignedlong ps_num2)
public function unsignedlong uf_not (unsignedlong ps_num)
public function unsignedlong uf_and (unsignedlong ps_num1, unsignedlong ps_num2)
public subroutine uf_converttowordarray (string ps_smessage, ref long ps_wordarray[])
public subroutine uf_md5_ff (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, integer ps_s, long ps_ac)
public function string uf_wordtohex (long ps_lvalue)
public function string uf_long2hex (long ps_long)
public function long uf_addunsigned (long ps_x, long ps_y)
public function string uf_md5 (string ps_password)
end prototypes

public function long uf_rshift (long ps_lvalue, long ps_ishiftbits);long ll_rtn

If ps_iShiftBits = 0 Then
 return ps_lValue
ElseIf ps_iShiftBits = 31 Then
 If uf_And(ps_lValue,2147483648)>0 Then   //&H80000000=2147483648
  return 1
 Else
  return 0
 End If
ElseIf ps_iShiftBits < 0 Or ps_iShiftBits > 31 Then
 messagebox("Err","Err")
 return -1
End If

ll_rtn = uf_And(ps_lValue,2147483646) / il_l2Power[ps_iShiftBits]  //&H7FFFFFFE=2147483646

If uf_And(ps_lValue,2147483648)>0 Then
 ll_rtn = uf_Or(ll_rtn , (1073741824 / il_l2Power[ps_iShiftBits - 1]))  //&H40000000=1073741824
End If

return ll_rtn

 

 

 

 

 

//string ls_rtn
//integer li_rtn
//
//If ps_ps_iShiftBits = 0 Then
// return ps_ps_lValue
//ElseIf ps_ps_iShiftBits = 31 Then
// If uf_And(ps_ps_lValue,uf_long2binary(2147483648),ls_rtn)>0 Then   //&H80000000
//  return uf_long2binary(1)
// Else
//  return uf_long2binary(0)
// End If
//ElseIf ps_ps_iShiftBits < 0 Or ps_ps_iShiftBits > 31 Then
//return "Err"
//End If
//
//li_rtn = uf_And(ps_ps_lValue,uf_long2binary(2147483646),ls_rtn) / il_l2Power[ps_ps_iShiftBits]  //&H7FFFFFFE
//
//ls_rtn = uf_long2binary(li_rtn)
//
//If uf_And(ps_ps_lValue,uf_long2binary(2147483648),ls_rtn)>0 Then 
// uf_Or(ls_rtn ,uf_long2binary(1073741824 / il_l2Power[ps_ps_iShiftBits - 1]),ls_rtn)  //&H40000000
//End If
//
//return ls_rtn
//
end function

public function long uf_RotateLeft (long ps_lValue, long ps_iShiftBits);return uf_Or(uf_LShift(ps_lValue, ps_iShiftBits),uf_RShift(ps_lValue, (32 - ps_iShiftBits)))
end function

public subroutine uf_md5_hh (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac);ps_a = uf_AddUnsigned(ps_a, uf_AddUnsigned(uf_AddUnsigned(uf_md5_H(ps_b, ps_c, ps_d), ps_x), ps_ac))
ps_a = uf_RotateLeft(ps_a, ps_s)
ps_a = uf_AddUnsigned(ps_a, ps_b)
end subroutine

public subroutine uf_md5_ii (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac);ps_a = uf_AddUnsigned(ps_a, uf_AddUnsigned(uf_AddUnsigned(uf_md5_I(ps_b, ps_c, ps_d), ps_x), ps_ac))
ps_a = uf_RotateLeft(ps_a, ps_s)
ps_a = uf_AddUnsigned(ps_a, ps_b)
end subroutine

public subroutine uf_md5_gg (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, long ps_s, long ps_ac);ps_a = uf_AddUnsigned(ps_a, uf_AddUnsigned(uf_AddUnsigned(uf_md5_G(ps_b, ps_c, ps_d), ps_x), ps_ac))
ps_a = uf_RotateLeft(ps_a, ps_s)
ps_a = uf_AddUnsigned(ps_a, ps_b)
end subroutine

public function long uf_md5_i (long ps_x, long ps_y, long ps_z);return uf_Xor(ps_y,uf_Or(ps_x , uf_Not(ps_z)))
end function

public function long uf_md5_h (long ps_x, long ps_y, long ps_z);return uf_Xor(uf_Xor(ps_x,ps_y),ps_z)
end function

public function long uf_md5_g (long ps_x, long ps_y, long ps_z);return uf_Or(uf_And(ps_x,ps_z) , uf_And(ps_y , uf_Not(ps_z)))
end function

public function long uf_md5_f (long ps_x, long ps_y, long ps_z);//md5_F = (x And y) Or ((Not x) And z)

return uf_Or(uf_And(ps_x,ps_y),uf_And(uf_Not(ps_x),ps_z))

end function

public function long uf_binary2long (string ps_binary);integer i
long ll_rtn,ll_2i

for i=1 to len(ps_binary)
 if i=1 then
  ll_2i=1
 else
  ll_2i=2*ll_2i
 end if
 ll_rtn=ll_rtn+ll_2i*long(mid(ps_binary,len(ps_binary) -i+1,1))
next

return ll_rtn
 
  
  
end function

public function long uf_lshift (long ps_lvalue, long ps_ishiftbits);long ll_rtn

If ps_iShiftBits = 0 Then
 return ps_lValue
ElseIf ps_iShiftBits = 31 Then
 If uf_And(ps_lValue,1)>0 Then
  return 2147483648   // &H80000000=2147483648
 Else
  return 0
 End If
ElseIf ps_iShiftBits < 0 Or ps_iShiftBits > 31 Then
 messagebox("Err","Err")
 return -1
End If

If uf_And(ps_lValue,il_l2Power[31 - ps_iShiftBits])>0 Then
 ll_rtn = uf_Or(uf_And(ps_lValue,il_lOnBits[31 - (ps_iShiftBits + 1)]) * il_l2Power[ps_iShiftBits],2147483648)   // &H80000000=2147483648
Else
 ll_rtn = (uf_And(ps_lValue,il_lOnBits[31 - ps_iShiftBits]) * il_l2Power[ps_iShiftBits])
End If

return ll_rtn

end function

public function long uf_xor (long ps_num1, long ps_num2);//====================================================================
// 函数[Function]:- uf_Xor for uo_md5
//--------------------------------------------------------------------
// 描述[Description]:实现位操作XOR,0 xor 0 = 0 , 1 xor 0 = 1,1 xor 1 =0
//--------------------------------------------------------------------
// 参数[Arguments]: 
//
// 参数(1): unsignedlong ps_num1
//  <description>
// 参数(2): unsignedlong ps_num2
//  <description>
//--------------------------------------------------------------------
// 返回值[Returns]: (UNSIGNEDLONG)
//====================================================================

 

unsignedlong  max,n,lul_rtn;
long i;
boolean lb_bit1[1 to 32],lb_bit2[1 to 32];

max = 2^32 -1;
for i=1 to 32
 lb_bit1[i]=false
 lb_bit2[i]=false
next
for i=31 to 0 step -1
 n = 2^i;
 if ps_num1>=n then
  lb_bit1[i+1]=true;
  ps_num1 = ps_num1 - n;
 else
  lb_bit1[i+1]=false;
 end if
 if ps_num2>=n then
  lb_bit2[i+1]=true;
  ps_num2 = ps_num2 - n
 else
  lb_bit2[i+1]=false
 end if 
next
for i=1 to 32
 if lb_bit1[i] <> lb_bit2[i] then
  lul_rtn += 2^(i -1)
 end if
next

return lul_rtn
end function

public function unsignedlong uf_or (unsignedlong ps_num1, unsignedlong ps_num2);//====================================================================
// 函数[Function]:- uf_Or for uo_md5
//--------------------------------------------------------------------
// 描述[Description]: 实现位操作Or,0 Or 0 =0 , 1 Or 0 = 1, 1 Or 1 = 1
//--------------------------------------------------------------------
// 参数[Arguments]: 
//
// 参数(1): unsignedlong ps_num1
//  <description>
// 参数(2): unsignedlong ps_num2
//  <description>
//--------------------------------------------------------------------
// 返回值[Returns]: (UNSIGNEDLONG)
//====================================================================


unsignedlong  max,n,lul_rtn
long i
boolean lb_bit1[1 to 32],lb_bit2[1 to 32]

max = 2^32 -1
for i=1 to 32
 lb_bit1[i]=false
 lb_bit2[i]=false
next
for i=31 to 0 step -1
 n = 2^i
 if ps_num1>=n then
  lb_bit1[i+1]=true
  ps_num1 = ps_num1 - n
 else
  lb_bit1[i+1]=false
 end if
 if ps_num2>=n then
  lb_bit2[i+1]=true
  ps_num2 = ps_num2 - n
 else
  lb_bit2[i+1]=false
 end if 
next
for i=1 to 32
 if lb_bit1[i] or lb_bit2[i] then
  lul_rtn += 2^(i -1)
 end if
next

return lul_rtn

end function

public function unsignedlong uf_not (unsignedlong ps_num);//====================================================================
// 函数[Function]:- uf_Not for uo_md5
//--------------------------------------------------------------------
// 描述[Description]: 实现位操作Not,Not 0 =1 , Not 1 = 1
//--------------------------------------------------------------------
// 参数[Arguments]: 
//
// 参数): unsignedlong ps_num
//  <description>
//--------------------------------------------------------------------
// 返回值[Returns]: (UNSIGNEDLONG)
//====================================================================


unsignedlong  max,n,lul_rtn
long i,kkk
boolean lb_bit[1 to 32]

max = 2^32 -1
for i=1 to 32
 lb_bit[i]=false
next
for i=31 to 0 step -1
 n = 2^i
 if ps_num>=n then
  lb_bit[i+1]=true
  ps_num = ps_num - n
 else
  lb_bit[i+1]=false
 end if
next
for i=1 to 32
 if lb_bit[i]=false then
  lul_rtn += 2^(i -1)
 end if
next

return lul_rtn

end function

public function unsignedlong uf_and (unsignedlong ps_num1, unsignedlong ps_num2);//====================================================================
// 函数[Function]:- uf_And for uo_md5
//--------------------------------------------------------------------
// 描述[Description]: 实现位操作And,0 And 0 =0 , 1 And 0 = 0, 1 And 1 = 1
//--------------------------------------------------------------------
// 参数[Arguments]: 
//
// 参数(1): unsignedlong ps_num1
//  <description>
// 参数(2): unsignedlong ps_num2
//  <description>
//--------------------------------------------------------------------
// 返回值[Returns]: (UNSIGNEDLONG)
//====================================================================


unsignedlong  max,n,lul_rtn
long i
boolean lb_bit1[1 to 32],lb_bit2[1 to 32]

max = 2^32 -1
for i=1 to 32
 lb_bit1[i]=false
 lb_bit2[i]=false
next
for i=31 to 0 step -1
 n = 2^i
 if ps_num1>=n then
  lb_bit1[i+1]=true
  ps_num1 = ps_num1 - n
 else
  lb_bit1[i+1]=false
 end if
 if ps_num2>=n then
  lb_bit2[i+1]=true
  ps_num2 = ps_num2 - n
 else
  lb_bit2[i+1]=false
 end if 
next
for i=1 to 32
 if lb_bit1[i] and lb_bit2[i] then
  lul_rtn += 2^(i -1)
 end if
next

return lul_rtn

end function

public subroutine uf_converttowordarray (string ps_smessage, ref long ps_wordarray[]);integer li_MessageLength
integer li_NumberOfWords
integer li_BytePosition
integer li_ByteCount
integer li_WordCount

integer MODULUS_BITS = 512
integer CONGRUENT_BITS = 448
integer i
long ll_xxx[0 to 100]

for i=0 to 100
 setnull(ll_xxx[i])
next

li_MessageLength = Len(ps_sMessage)
li_NumberOfWords = (int((li_MessageLength + int((MODULUS_BITS - CONGRUENT_BITS) / BITS_TO_A_BYTE)) / int(MODULUS_BITS / BITS_TO_A_BYTE)) + 1) * int(MODULUS_BITS / BITS_TO_A_WORD)

li_BytePosition = 0
li_ByteCount = 0

Do Until li_ByteCount >= li_MessageLength
 li_WordCount = int(li_ByteCount / BYTES_TO_A_WORD)
 li_BytePosition = Mod(li_ByteCount , BYTES_TO_A_WORD) * BITS_TO_A_BYTE
 ll_xxx[li_WordCount] = uf_Or(ll_xxx[li_WordCount],uf_LShift(Asc(Mid(ps_sMessage, li_ByteCount + 1, 1)), li_BytePosition))
 li_ByteCount = li_ByteCount + 1
Loop

li_WordCount = int(li_ByteCount / BYTES_TO_A_WORD)
li_BytePosition = mod(li_ByteCount,BYTES_TO_A_WORD) * BITS_TO_A_BYTE

ll_xxx[li_WordCount] = uf_Or(ll_xxx[li_WordCount],uf_LShift(128, li_BytePosition))  //&H80=128

ll_xxx[li_NumberOfWords - 2] = uf_LShift(li_MessageLength, 3)
ll_xxx[li_NumberOfWords - 1] = uf_RShift(li_MessageLength, 29)

for i=0 to li_NumberOfWords -1
 ps_wordarray[i+1]=ll_xxx[i]
next

 


end subroutine

public subroutine uf_md5_ff (ref long ps_a, ref long ps_b, ref long ps_c, ref long ps_d, long ps_x, integer ps_s, long ps_ac);ps_a = uf_AddUnsigned(ps_a, uf_AddUnsigned(uf_AddUnsigned(uf_md5_F(ps_b, ps_c, ps_d), ps_x), ps_ac))
ps_a = uf_RotateLeft(ps_a, ps_s)
ps_a = uf_AddUnsigned(ps_a, ps_b)

return
end subroutine

public function string uf_wordtohex (long ps_lvalue);long ll_Byte,ll_Count
string ls_rtn,kk

For ll_Count = 0 To 3
 ll_Byte = uf_And(uf_RShift(ps_lValue, ll_Count * BITS_TO_A_BYTE) , il_lOnBits[BITS_TO_A_BYTE - 1])
 kk=uf_long2Hex(ll_Byte)
 ls_rtn = ls_rtn + Right("0" + uf_long2Hex(ll_Byte), 2)

Next

return ls_rtn


end function

public function string uf_long2hex (long ps_long);string ls_rtn
integer i
long ll_temp

ll_temp=ps_long
do while ll_temp/16>0 
 if mod(ll_temp,16)<10 then
  ls_rtn=string(mod(ll_temp,16))+ls_rtn
 elseif mod(ll_temp,16)=10 then
  ls_rtn="a"+ls_rtn
 elseif mod(ll_temp,16)=11 then
  ls_rtn="b"+ls_rtn 
 elseif mod(ll_temp,16)=12 then
  ls_rtn="c"+ls_rtn
 elseif mod(ll_temp,16)=13 then
  ls_rtn="d"+ls_rtn
 elseif mod(ll_temp,16)=14 then
  ls_rtn="e"+ls_rtn
 elseif mod(ll_temp,16)=15 then
  ls_rtn="f"+ls_rtn
 end if
 ll_temp=ll_temp/16
loop

return upper(ls_rtn)


end function

public function long uf_addunsigned (long ps_x, long ps_y);long ll_X4,ll_Y4,ll_X8,ll_Y8,ll_Result
 
ll_X8 = uf_And(ps_X,2147483648) // &H80000000
ll_Y8 = uf_And(ps_Y,2147483648) // &H80000000
ll_X4 = uf_And(ps_X,1073741824) // &H40000000
ll_Y4 = uf_And(ps_Y,1073741824) // &H40000000
 
ll_Result = uf_And(ps_X,1073741823) + uf_And(ps_Y,1073741823)  //&H3FFFFFFF
 
If uf_And(ll_X4,ll_Y4)>0 Then
 ll_Result = uf_Xor(uf_Xor(uf_Xor(ll_Result,2147483648),ll_X8),ll_Y8)
ElseIf uf_Or(ll_X4,ll_Y4)>0 Then
 If uf_And(ll_Result,1073741824)>0 Then  // &H40000000
  ll_Result = uf_Xor(uf_Xor(uf_Xor(ll_Result,3221225472),ll_X8),ll_Y8)  //&HC0000000
 Else
  ll_Result = uf_Xor(uf_Xor(uf_Xor(ll_Result,1073741824),ll_X8),ll_Y8)  // &H40000000
 End If
Else
 ll_Result = uf_Xor(uf_Xor(ll_Result,ll_X8),ll_Y8)
End If

return ll_Result


end function

public function string uf_md5 (string ps_password);integer S11 = 7
integer S12 = 12
integer S13 = 17
integer S14 = 22
integer S21 = 5
integer S22 = 9
integer S23 = 14
integer S24 = 20
integer S31 = 4
integer S32 = 11
integer S33 = 16
integer S34 = 23
integer S41 = 6
integer S42 = 10
integer S43 = 15
integer S44 = 21

long x[]
integer k
long AA,a = 1732584193  //&H67452301
long BB,b = 4023233417  //&HEFCDAB89
long CC,c = 2562383102  //&H98BADCFE
long DD,d = 271733878  //&H10325476

uf_ConvertToWordArray(ps_password,x)

For k = 1 To UpperBound(x)  Step 16
 AA = a
 BB = b
 CC = c
 DD = d
  
 uf_md5_FF( a, b, c, d, x[k + 0], S11,3614090360)   //&HD76AA478
 uf_md5_FF( d, a, b, c, x[k + 1], S12,3905402710)   //&HE8C7B756
 uf_md5_FF( c, d, a, b, x[k + 2], S13,606105819)   //&H242070DB
 uf_md5_FF( b, c, d, a, x[k + 3], S14,3250441966)   //&HC1BDCEEE
 uf_md5_FF( a, b, c, d, x[k + 4], S11,4118548399)   //&HF57C0FAF
 uf_md5_FF( d, a, b, c, x[k + 5], S12,1200080426)   //&H4787C62A
 uf_md5_FF( c, d, a, b, x[k + 6], S13,2821735955)   //&HA8304613
 uf_md5_FF( b, c, d, a, x[k + 7], S14,4249261313)   //&HFD469501
 uf_md5_FF( a, b, c, d, x[k + 8], S11,1770035416)   //&H698098D8
 uf_md5_FF( d, a, b, c, x[k + 9], S12,2336552879)   //&H8B44F7AF
 uf_md5_FF( c, d, a, b, x[k + 10], S13,4294925233)  //&HFFFF5BB1
 uf_md5_FF( b, c, d, a, x[k + 11], S14,2304563134)   //&H895CD7BE
 uf_md5_FF( a, b, c, d, x[k + 12], S11,1804603682)   //&H6B901122
 uf_md5_FF( d, a, b, c, x[k + 13], S12,4254626195)   //&HFD987193
 uf_md5_FF( c, d, a, b, x[k + 14], S13,2792965006)   //&HA679438E
 uf_md5_FF( b, c, d, a, x[k + 15], S14,1236535329)   //&H49B40821
  
 uf_md5_GG( a, b, c, d, x[k + 1], S21,4129170786)    //&HF61E2562
 uf_md5_GG( d, a, b, c, x[k + 6], S22,3225465664)  //&HC040B340
 uf_md5_GG( c, d, a, b, x[k + 11], S23,643717713)  //&H265E5A51
 uf_md5_GG( b, c, d, a, x[k + 0], S24,3921069994)   //&HE9B6C7AA
 uf_md5_GG( a, b, c, d, x[k + 5], S21,3593408605)    //&HD62F105D
 uf_md5_GG( d, a, b, c, x[k + 10], S22,38016083)    //&H2441453
 uf_md5_GG( c, d, a, b, x[k + 15], S23,3634488961)   //&HD8A1E681
 uf_md5_GG( b, c, d, a, x[k + 4], S24,3889429448)    //&HE7D3FBC8
 uf_md5_GG( a, b, c, d, x[k + 9], S21,568446438)    //&H21E1CDE6
 uf_md5_GG( d, a, b, c, x[k + 14], S22,3275163606)   //&HC33707D6
 uf_md5_GG( c, d, a, b, x[k + 3], S23,4107603335)   //&HF4D50D87
 uf_md5_GG( b, c, d, a, x[k + 8], S24,1163531501)   //&H455A14ED
 uf_md5_GG( a, b, c, d, x[k + 13], S21,2850285829)   //&HA9E3E905
 uf_md5_GG( d, a, b, c, x[k + 2], S22,4243563512)   //&HFCEFA3F8
 uf_md5_GG( c, d, a, b, x[k + 7], S23,1735328473)  //&H676F02D9
 uf_md5_GG( b, c, d, a, x[k + 12], S24,2368359562)   //&H8D2A4C8A
  
 uf_md5_HH( a, b, c, d, x[k + 5], S31,4294588738)   //&HFFFA3942
 uf_md5_HH( d, a, b, c, x[k + 8], S32,2272392833)   //&H8771F681
 uf_md5_HH( c, d, a, b, x[k + 11], S33,1839030562)   //&H6D9D6122
 uf_md5_HH( b, c, d, a, x[k + 14], S34,4259657740)   //&HFDE5380C
 uf_md5_HH( a, b, c, d, x[k + 1], S31,2763975236)  // &HA4BEEA44
 uf_md5_HH( d, a, b, c, x[k + 4], S32,1272893353)   //&H4BDECFA9
 uf_md5_HH( c, d, a, b, x[k + 7], S33,4139469664)   //&HF6BB4B60
 uf_md5_HH( b, c, d, a, x[k + 10], S34,3200236656)   //&HBEBFBC70
 uf_md5_HH( a, b, c, d, x[k + 13], S31,681279174)   //&H289B7EC6
 uf_md5_HH( d, a, b, c, x[k + 0], S32,3936430074)   //&HEAA127FA
 uf_md5_HH( c, d, a, b, x[k + 3], S33,3572445317)   //&HD4EF3085
 uf_md5_HH( b, c, d, a, x[k + 6], S34,76029189)    //&H4881D05
 uf_md5_HH( a, b, c, d, x[k + 9], S31,3654602809)   //&HD9D4D039
 uf_md5_HH( d, a, b, c, x[k + 12], S32,3873151461)   //&HE6DB99E5
 uf_md5_HH( c, d, a, b, x[k + 15], S33,530742520)   //&H1FA27CF8
 uf_md5_HH( b, c, d, a, x[k + 2], S34,3299628645)   //&HC4AC5665
  
 uf_md5_II( a, b, c, d, x[k + 0], S41,4096336452)  //&HF4292244
 uf_md5_II( d, a, b, c, x[k + 7], S42,1126891415)   //&H432AFF97
 uf_md5_II( c, d, a, b, x[k + 14], S43,2878612391)   //&HAB9423A7
 uf_md5_II( b, c, d, a, x[k + 5], S44,4237533241)   //&HFC93A039
 uf_md5_II( a, b, c, d, x[k + 12], S41,1700485571)   //&H655B59C3
 uf_md5_II( d, a, b, c, x[k + 3], S42,2399980690)   //&H8F0CCC92
 uf_md5_II( c, d, a, b, x[k + 10], S43,4293915773)   //&HFFEFF47D
 uf_md5_II( b, c, d, a, x[k + 1], S44,2240044497)   //&H85845DD1
 uf_md5_II( a, b, c, d, x[k + 8], S41,1873313359)   //&H6FA87E4F
 uf_md5_II( d, a, b, c, x[k + 15], S42,4264355552)   //&HFE2CE6E0
 uf_md5_II( c, d, a, b, x[k + 6], S43,2734768916)   //&HA3014314
 uf_md5_II( b, c, d, a, x[k + 13], S44,1309151649)   //&H4E0811A1
 uf_md5_II( a, b, c, d, x[k + 4], S41,4149444226)   //&HF7537E82
 uf_md5_II( d, a, b, c, x[k + 11], S42,3174756917)   //&HBD3AF235
 uf_md5_II( c, d, a, b, x[k + 2], S43,718787259)   //&H2AD7D2BB
 uf_md5_II( b, c, d, a, x[k + 9], S44,3951481745)   //&HEB86D391
  
 a = uf_AddUnsigned(a, AA)
 b = uf_AddUnsigned(b, BB)
 c = uf_AddUnsigned(c, CC)
 d = uf_AddUnsigned(d, DD) 
Next

return lower(uf_WordToHex(a) + uf_WordToHex(b) + uf_WordToHex(c) + uf_WordToHex(d))
//return lower( uf_WordToHex(b) + uf_WordToHex(c))

end function

on nvo_md5.create
call super::create
TriggerEvent( this, "constructor" )
end on

on nvo_md5.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event constructor;il_lOnBits[0] = 1
il_lOnBits[1] = 3
il_lOnBits[2] = 7
il_lOnBits[3] = 15
il_lOnBits[4] = 31
il_lOnBits[5] = 63
il_lOnBits[6] = 127
il_lOnBits[7] = 255
il_lOnBits[8] = 511
il_lOnBits[9] = 1023
il_lOnBits[10] = 2047
il_lOnBits[11] = 4095
il_lOnBits[12] = 8191
il_lOnBits[13] = 16383
il_lOnBits[14] = 32767
il_lOnBits[15] = 65535
il_lOnBits[16] = 131071
il_lOnBits[17] = 262143
il_lOnBits[18] = 524287
il_lOnBits[19] = 1048575
il_lOnBits[20] = 2097151
il_lOnBits[21] = 4194303
il_lOnBits[22] = 8388607
il_lOnBits[23] = 16777215
il_lOnBits[24] = 33554431
il_lOnBits[25] = 67108863
il_lOnBits[26] = 134217727
il_lOnBits[27] = 268435455
il_lOnBits[28] = 536870911
il_lOnBits[29] = 1073741823
il_lOnBits[30] = 2147483647

il_l2Power[0] = 1
il_l2Power[1] = 2
il_l2Power[2] = 4
il_l2Power[3] = 8
il_l2Power[4] = 16
il_l2Power[5] = 32
il_l2Power[6] = 64
il_l2Power[7] = 128
il_l2Power[8] = 256
il_l2Power[9] = 512
il_l2Power[10] = 1024
il_l2Power[11] = 2048
il_l2Power[12] = 4096
il_l2Power[13] = 8192
il_l2Power[14] = 16384
il_l2Power[15] = 32768
il_l2Power[16] = 65536
il_l2Power[17] = 131072
il_l2Power[18] = 262144
il_l2Power[19] = 524288
il_l2Power[20] = 1048576
il_l2Power[21] = 2097152
il_l2Power[22] = 4194304
il_l2Power[23] = 8388608
il_l2Power[24] = 16777216
il_l2Power[25] = 33554432
il_l2Power[26] = 67108864
il_l2Power[27] = 134217728
il_l2Power[28] = 268435456
il_l2Power[29] = 536870912
il_l2Power[30] = 1073741824
end event

 

文章如转载,请注明转载自:http://www.5iadmin.com/post/953.html