Local $password = _JiaMi("我是密码?")
MsgBox(262144,'加密后的密码:',$password)
Local $origial = _JieMi($password)
MsgBox(262144,'解密后的原密码:',$origial)
Func _JiaMi($iPassword)
Local $b = "", $e = ""
Local $e = $iPassword
$iPassword = ""
Local $f = 0
While StringLen($e) <> $f
$f += 1
$buffer = StringToBinary(StringMid($e, $f, 1))
$buffer = StringRight($buffer, StringLen($buffer) - 2)
If StringLen($buffer) = 2 Then
$iPassword = $iPassword & ChrW(Dec($buffer))
Else
$iPassword = $iPassword & ChrW(Dec(StringLeft($buffer, 2))) & ChrW(Dec(StringRight($buffer, 2)))
EndIf
WEnd
While StringLen($iPassword) <> Int(StringLen($iPassword) / 3) * 3
$iPassword = $iPassword & " "
WEnd
For $i = 1 To StringLen($iPassword) / 3
$c = 0
For $j = 1 To 3
$c += AscW(StringMid($iPassword, ($i - 1) * 3 + $j, 1)) * (256 ^ (3 - $j))
Next
For $j = 1 To 4
$d = Int($c / (64 ^ (4 - $j)))
$c = $c - $d * (64 ^ (4 - $j))
$b = $b & _code($d)
Next
Next
If StringLen($b) <= 240 Then
ClipPut($b)
Return $b
Else
Return SetError(-1)
EndIf
EndFunc ;==>_JiaMi
Func _code($z)
Local $y
If $z < 26 Then
$y = ChrW($z + 65)
Else
If $z < 52 Then
$y = ChrW($z + 71)
Else
If $z < 62 Then
$y = ChrW($z - 4)
Else
If $z = 62 Then
$y = "-"
Else
$y = "_"
EndIf
EndIf
EndIf
EndIf
Return $y
EndFunc ;==>_code
Func _JieMi($a)
Local $e = "", $f = ""
For $i = 1 To StringLen($a) / 4
$c = 0
For $j = 1 To 4
$b = StringMid($a, ($i - 1) * 4 + $j, 1)
$c = $c + num($b) * (64 ^ (4 - $j))
Next
For $j = 1 To 3
$d = Int($c / (256 ^ (3 - $j)))
$c = $c - $d * (256 ^ (3 - $j))
$e = $e & ChrW($d)
Next
Next
$f = $e
$e = ""
For $i = 1 To StringLen($f)
If AscW(StringMid($f, $i, 1)) < 129 Then
$e = $e & StringMid($f, $i, 1)
Else
$j = "0x" & StringRight(Hex(AscW(StringMid($f, $i, 1))), 2) & StringRight(Hex(AscW(StringMid($f, $i + 1, 1))), 2)
$e = $e & BinaryToString($j)
$i += 1
EndIf
Next
Return $e
EndFunc ;==>_JieMi
Func num($z)
Local $y, $x
$y = AscW($z)
If $z = "-" Then
$x = 62
Else
If $z = "_" Then
$x = 63
Else
If $y < 58 Then
$x = $y + 4
Else
If $y < 91 Then
$x = $y - 65
Else
$x = $y - 71
EndIf
EndIf
EndIf
EndIf
Return $x
EndFunc ;==>num
回复 1# glsanshi |