Encrypt OR Decrypt a String Using ASCII Character.


Function used for Encrypting and Decrypting the String (User Password)

Purpose : Function used for Encrypting and Decrypting the String (User Password)
Variable : Variable Text(String to be Encrypted/Decrypted) used in this Function

Code :

    Public Function fnEnCryptDeCrypt(ByVal Text As String) As String
Dim strTempChar As String = "", i As Integer
For i = 1 To Len(Text)
If Asc(Mid$(Text, i, 1)) < 128 Then
strTempChar = CType(Asc(Mid$(Text, i, 1)) + 128, String)
ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
strTempChar = CType(Asc(Mid$(Text, i, 1)) - 128, String)
End If
Mid$(Text, i, 1) = Chr(CType(strTempChar, Integer))
Next i
Return Text
End Function


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: