📄 encipher.bas
字号:
Attribute VB_Name = "Encipher"
Public pass As String
Function DeCipher(Ciphered$, pazz$)
Dim start$, endd$
If pazz$ = "" Then MsgBox "Please put in a password", 12, "Cipher": Exit Function
bforestart = Ciphered$
start = Ciphered$
On Error GoTo errhandler
Do
strt = pazz$
For i = 1 To Len(pazz$)
nmbr = Mid(strt, 1, 1)
AccessNum = Asc(nmbr)
strt = Right(strt, Len(strt) - 1)
edt = Mid(start$, 1, 1)
start$ = Right(start, Len(start$) - 1)
charac = Asc(edt) - AccessNum
endd$ = endd$ + Chr(Asc(edt) - AccessNum)
Next i
Loop Until itstops
errhandler:
ask = InStr(endd$, pazz$)
If ask Then
a = StrComp(ask, pazz$)
If a = 1 Then MsgBox "Access Denied", 12, "Cipher": Exit Function
endd$ = Right(endd$, Len(endd$) - Len(pazz$))
'MsgBox "Text DeCiphered", 12, "Cipher"
DeCipher = endd$
Else
'MsgBox "Access Denied", 12, "Cipher"
DeCipher = bforestart
End If
End Function
Function Encipher(Ciphered$, pazz$)
Dim start$, endd$, ndd$
If pazz$ = "" Then MsgBox "Please put in a password", 12, "Cipher": Exit Function
start$ = pazz$ + Ciphered$
On Error GoTo errhandler
Do
strt = pazz$
For i = 1 To Len(pazz$)
nmbr = Mid(strt, 1, 1)
AccessNum = Asc(nmbr)
strt = Right(strt, Len(strt) - 1)
edt = Mid(start$, 1, 1)
start$ = Right(start, Len(start$) - 1)
charac = Asc(edt) + AccessNum
endd$ = endd$ + Chr(Asc(edt) + AccessNum)
Next i
Loop Until itstops
errhandler:
'MsgBox "Text Ciphered", 12, "Cipher"
Encipher = endd$
End Function
Public Function PrepareData(InputData As String) As String
PrepareData = Encipher(InputData, pass)
End Function
Public Function DecodeData(InputData As String) As String
DecodeData = DeCipher(InputData, pass)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -