求VB对一串字符的加密解密程序 最简单的 高中学的那种
发布网友
发布时间:2022-09-27 23:08
我来回答
共1个回答
热心网友
时间:2024-03-31 20:18
'图上的控件,你就照着摆上去,然后再把以下代码拷进去,就OK了
Dim lg As Integer
'加密
Private Sub Command1_Click()
Text2 = ""
Dim a(), b() As String
lg = Len(Text1)
ReDim a(lg), b(lg)
For i = 1 To lg
a(i) = Mid(Text1, i, 1)
b(i) = AscW(a(i)) Xor 4
Text2 = Text2 & ChrW(b(i))
Next
End Sub
'解密
Private Sub Command2_Click()
Text3 = ""
Dim a(), b() As String
lg = Len(Text2)
ReDim a(lg), b(lg)
For i = 1 To lg
a(i) = Mid(Text2, i, 1)
b(i) = AscW(a(i)) Xor 4
Text3 = Text3 & ChrW(b(i))
Next
End Sub