求一种VB代码带KEY的加密解密代码。
1个回答
2009-03-25
展开全部
给你一个最简单加密 字符异或
Dim a As String
Dim b As String
Dim c As String
Private Sub Command1_Click()
b = Text1.Text
Text1.Text = ""
For i = 1 To Len(b)
a = Mid$(b, i, 1)
c = Asc(a) Xor 1111 '1111就是自定义KEY 只能为数值
If Text1.Text = "" Then
Text1.Text = c
Else
Text1.Text = Text1.Text & "," & c
End If
Next i
End Sub
Private Sub Command2_Click()
Dim d() As String
d() = Split(Text1.Text, ",")
Text1.Text = ""
For i = 0 To UBound(d)
a = d(i)
c = Chr(a Xor 1111)
Text1.Text = Text1.Text & c
Next i
End Sub
Dim a As String
Dim b As String
Dim c As String
Private Sub Command1_Click()
b = Text1.Text
Text1.Text = ""
For i = 1 To Len(b)
a = Mid$(b, i, 1)
c = Asc(a) Xor 1111 '1111就是自定义KEY 只能为数值
If Text1.Text = "" Then
Text1.Text = c
Else
Text1.Text = Text1.Text & "," & c
End If
Next i
End Sub
Private Sub Command2_Click()
Dim d() As String
d() = Split(Text1.Text, ",")
Text1.Text = ""
For i = 0 To UBound(d)
a = d(i)
c = Chr(a Xor 1111)
Text1.Text = Text1.Text & c
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询