📄 encryption.bas
字号:
Attribute VB_Name = "Encryption"
Option Explicit
Public Function Encrypt(Key1 As String, txtcode As String)
Dim i, j, k As Integer, thekey
Dim a, b, CryptText As String
On Error Resume Next
If Key1 <> "" Then
thekey = Key1
i = 0
For j = 1 To Len(txtcode)
i = i + 1
If i > Len(thekey) Then i = 1
a = Mid(txtcode, j, 1)
k = Asc(a)
b = Mid(thekey, i, 1)
k = k + Asc(b)
If k > 255 Then k = k - 255
CryptText = CryptText & Chr(k)
Next j
txtcode = CryptText
Encrypt = txtcode
End If
End Function
Public Function Decrypt(Key1 As String, txtcode As String)
Dim i, j, k As Integer, thekey
Dim a, b, CryptText As String
On Error Resume Next
CryptText = ""
If Key1 <> "" Then
thekey = Key1
i = 0
For j = 1 To Len(txtcode)
i = i + 1
If i > Len(thekey) Then i = 1
a = Mid(txtcode, j, 1)
k = Asc(a)
b = Mid(thekey, i, 1)
k = k - Asc(b)
If k < 0 Then k = k + 255
CryptText = CryptText & Chr(k)
Next j
txtcode = CryptText
Decrypt = txtcode
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -