Quick and easy encryption
Quick and easy encryption
Rate Quick and easy encryption
(2(2 Vote))
Public Function Encrypt(ByVal Plain As String)
Dim Letter As String
For I = 1 To Len(Plain)
Letter = Mid$(Plain, I, 1)
Mid$(Plain, I, 1) = Chr(Asc(Letter) + 1)
Next I
Encrypt = Plain
End Function
'Here's the Decryption function:
Public Function Decrypt(ByVal Encrypted As String)
Dim Letter As String
For I = 1 To Len(Encrypted)
Letter = Mid$(Encrypted, I, 1)
Mid$(Encrypted, I, 1) = Chr(Asc(Letter) - 1)
Next I
Decrypt = Encrypted
End Function
'here is sample code to test it....
Dim strMessage As String
strMessage = "Original:"
strMessage = strMessage & "This is a test" & vbCrLf
strMessage = strMessage & vbCrLf & "Encrypted:"
strMessage = strMessage & Encrypt("This is a test") & vbCrLf
strMessage = strMessage & vbCrLf & "Un-Encrypted:"
strMessage = strMessage & Decrypt(Encrypt("This is a test"))
MsgBox strMessage
Quick and easy encryption Comments
No comments yet — be the first to post one!
Post a Comment