还有一个这次新写的加密类。VB.NET的。支持中文加密。总体感觉不错。 - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 还有一个这次新写的加密类。VB.NET的。支持中文加密。总体感觉不错。 (http://www.webasp.net/article/5/4090.htm) |
| -- 作者:未知 -- 发布日期: 2003-07-12 |
| 只有一个方法,使用的时候很简单,比如要加密就这样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 |
| webasp.net |