Encrypt OR Decrypt a String Using ASCII Character.

Chikul
Posted by Chikul under VB.NET category on | Views : 5264
' Purpose : Function used for Encrypting and Decrypting the String (User Password)
' Variable : Variable Text(String to be Encrypted/Decrypted) used in this Function

    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 or Responses

Login to post response