Initial commit
This commit is contained in:
35
BMS/ZpCryptography/DsnCrypto.vb
Normal file
35
BMS/ZpCryptography/DsnCrypto.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Public Class DsnCrypto
|
||||
Public Shared Function Encrypt(ByVal strText As String, ByVal strPwd As String) As String
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String = ""
|
||||
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
Encrypt = strBuff
|
||||
End Function
|
||||
|
||||
Public Shared Function Decrypt(ByVal strText As String, ByVal strPwd As String) As String
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String = ""
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
Decrypt = strBuff
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user