VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Encrypt or Decrypt String

by MHari (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 29th November 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Encrypt or Decrypt String

API Declarations


'Pass the string to this function it returns the encrypted string in ascii codes



Rate Encrypt or Decrypt String



'Encryption function
Function StrEncode(ByVal s As String) As String
    
    Dim a

    b = ""
    i = 1
    a = s
    Do While i < Len(a) + 1
    b = b & (Asc(Mid(a, i, Len(a))) * 8)
    i = i + 1
    Loop
    StrEncode = b
    
End Function

'Pass the encrypted string to this function it returns the decrypted string
'Decryption function
Function StrDecode(ByVal s As String) As String
    
    Dim c As String
    Dim p As Integer
    
    j = 1
    c = ""
    b = s
    Do While j < Len(b) + 1
    p = Val(Mid(b, j, 3)) / 8
    c = c & Chr(p)
    j = j + 3
    Loop
    StrDecode = c

End Function

Download this snippet    Add to My Saved Code

Encrypt or Decrypt String Comments

No comments have been posted about Encrypt or Decrypt String. Why not be the first to post a comment about Encrypt or Decrypt String.

Post your comment

Subject:
Message:
0/1000 characters