VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Encryption and Decryption Function

by Cyrus Lacaba/Las Pi?as City, Manila (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 16th May 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple Encryption and Decryption Function

Rate Simple Encryption and Decryption Function



'blndec = True:Decrypt, False:Encrypt

Function EncDecryptData(ByVal strval$, ByVal blndec As Boolean) As String
Dim str, str1, str2, str3, str4 As String
Dim int1, int2, int3 As Integer
    
    str1 = strval$
    int1 = Len(str1)
    int2 = 1
    
    Do While int2 <> (int1 + 1)
        str2 = Mid(str1, int2, 1)
        If blndec = True Then
            int3 = Asc(str2) - 3        'Decrypt
        Else
            int3 = Asc(str2) + 3        'Encrypt
        End If
        str3 = Chr(int3)
        str4 = str4 & str3
        int2 = int2 + 1
    Loop

    EncDecryptData = str4

End Function

Download this snippet    Add to My Saved Code

Simple Encryption and Decryption Function Comments

No comments have been posted about Simple Encryption and Decryption Function. Why not be the first to post a comment about Simple Encryption and Decryption Function.

Post your comment

Subject:
Message:
0/1000 characters