我来试试:Global $a[11]
$a[0] = '2345678ab1'
$a[1] = 'xyzuvwopqZ'
$a[2] = 'ST9012345R'
$a[3] = 'FGHIJKLMNE'
$a[4] = '2345678ab1'
$a[5] = 'UVWXYZxyzn'
$a[6] = 'qrstOPQRSp'
$a[7] = '12345678a0'
$a[8] = 'HIJKLMNfgG'
$a[9] = 'BCDEFGHIJA'
$a[10] = 'qrstOPQRSp'
While 1
$InputBox = InputBox("加/解密 by pcbar", "请输入需进行加/解密的字符串:", "12345678901", " M11", "-1", "130", "-1", "-1")
Select
Case @error = 0 ;OK - The string returned is valid
If StringLen($InputBox) <> 11 Then
MsgBox(0, "--", "字符长度不符要求!")
ContinueLoop
EndIf
If StringIsDigit($InputBox) Then
jiami($InputBox)
Else
jiemi($InputBox)
EndIf
Case @error = 1 ;The Cancel button was pushed
Exit
Case @error = 3 ;The InputBox failed to open
Exit
EndSelect
WEnd
Func jiami($x)
Local $b
For $i = 0 To 10
$b &= StringMid($a[$i], StringMid($x, $i + 1, 1) + 1, 1)
Next
ClipPut($b)
MsgBox(0, "完成", "字符串 " & $x & " 加密为 " & $b & " ,密文已存入剪贴板.")
EndFunc ;==>jiami
Func jiemi($y)
Local $b, $t
For $i = 0 To 10
$t = StringInStr($a[$i], StringMid($y, $i + 1, 1), 1)
If $t = 0 Then
MsgBox(0, "--", "密文输入有误!")
Return
EndIf
$b &= $t - 1
Next
ClipPut($b)
MsgBox(0, "完成", "字符串 " & $y & " 解密为 " & $b & " ,明文已存入剪贴板.")
EndFunc ;==>jiemi
|