没测试 你自己测试下
Func CNCMAXEncode($input)
$DicStr = "9012345678abcdeABCDEFGHIJKLMNfghijklmnUVWXYZxyzuvwopqrstOPQRST"
Dim $DicB[16]
$DicB[0] = 0x11
$DicB[1] = 0x34
$DicB[2] = 0xC9
$DicB[3] = 0x23
$DicB[4] = 0x75
$DicB[5] = 0x18
$DicB[6] = 0xD7
$DicB[7] = 0xE2
$DicB[8] = 0x12
$DicB[9] = 0x35
$DicB[10] = 0x29
$DicB[11] = 0x2B
$DicB[12] = 0xEC
$DicB[13] = 0xB6
$DicB[14] = 0x23
$DicB[15] = 0x19
$num4 = 0x25
$di = $var2 = $index = $var3 = 0
Dim $outstr[1]
$outstr[0] = ""
For $i = 0 To StringLen($input) - 1
For $j = 0 To StringLen($DicStr) - 1
If $input[$i] == StringMid($DicStr,$j+1,1) Then
If $i >= 0x10 Then
$di = $DicB[Mod($i, 0x10)]
Else
$di = $DicB[$i]
EndIf
$var2 = $num4 * 3
$index = Mod((BitXOR(BitXOR($di, $var2), $var3) + $j), 0x3e)
$outstr[$i] = StringMid($DicStr,$index+1,1)
$var2 = $index
$num4 = BitXOR($num4, $var2 + 0x24d9)
EndIf
Next
If $i >= UBound($outstr) Then
ReDim $outstr[$i]
$outstr[$i] = $input[$i]
EndIf
$var3 = $var3 + 5
Next
$out = ""
For $k = 0 To UBound($outstr) - 1
$out = $out & $outstr[$k]
Next
Return "1:" & $out
EndFunc ;==>CNCMAXEncode
Func CNCMAXDecode($string)
$src_temp = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
If StringMid($string, 1, 2) = "2:" Then $string = StringMid($string, 3)
$TempString = $TempString1 = ""
For $j = 0 To StringLen($string)
For $i = 0 To 61
$TempString = $TempString1 & StringMid($src_temp, $i + 1, 1)
If CNCMAXEncode($TempString) = StringMid($string, 1, $j) Then
$TempString1 = $TempString
ExitLoop
EndIf
Next
Next
Return $TempString1
|