最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
还有一个这次新写的加密类。VB.NET的。支持中文加密。总体感觉不错。
时间:2022-07-02 12:13:44 编辑:袖梨 来源:一聚教程网
只有一个方法,使用的时候很简单,比如要加密就这样EnDeCode("Data",1234)
解密的时候还是这样EnDeCode("Data",1234)。很简单的。
代码:
Public Class Encryption
Public Function EnDeCode(ByVal Source As String, ByVal Key As Integer) As String
Dim X As Single
Dim intCharNumber As Integer
Dim shtRADInt As Short
Dim strChar As String
Dim strTmp As String
If Key < 0 Then
Key = Key * (-1)
End If
X = Rnd(-Key)
Dim i As Integer
For i = 1 To Len(Source) Step 1
strChar = Mid(Source, i, 1)
intCharNumber = Asc(strChar)
WhileEncode:
shtRADInt = Int(127 * Rnd())
If shtRADInt < 30 Or shtRADInt > 100 Then GoTo WhileEncode
intCharNumber = intCharNumber Xor shtRADInt
strTmp = strTmp & Chr(intCharNumber)
Next i
EnDeCode = strTmp
Exit Function
End Function
End Class
解密的时候还是这样EnDeCode("Data",1234)。很简单的。
代码:
Public Class Encryption
Public Function EnDeCode(ByVal Source As String, ByVal Key As Integer) As String
Dim X As Single
Dim intCharNumber As Integer
Dim shtRADInt As Short
Dim strChar As String
Dim strTmp As String
If Key < 0 Then
Key = Key * (-1)
End If
X = Rnd(-Key)
Dim i As Integer
For i = 1 To Len(Source) Step 1
strChar = Mid(Source, i, 1)
intCharNumber = Asc(strChar)
WhileEncode:
shtRADInt = Int(127 * Rnd())
If shtRADInt < 30 Or shtRADInt > 100 Then GoTo WhileEncode
intCharNumber = intCharNumber Xor shtRADInt
strTmp = strTmp & Chr(intCharNumber)
Next i
EnDeCode = strTmp
Exit Function
End Function
End Class
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21