by N. Pandu Ranga Rao. (3 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 5th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Encrypt & Decrypt using a key value...
API Declarations
for eg.
Text2.Text = Encrypt(Text1.Text, 127) 'Encrypts Text1 contents.
Text3.Text = Encrypt(Text2.Text, 127, True) 'DeCrypts Text2 contents and places into Text3.
Dim str1, Result As String
str1 = EncryptString
For i = 1 To Len(str1)
Select Case Decrypt
Case False
Result = Result & Chr(Asc(Mid(str1, i, 1)) + Key)
Case True
Result = Result & Chr(Asc(Mid(str1, i, 1)) - Key)
End Select
Next
Encrypt = Result
End Function