Advertisement
ZeekoSec

Text Encrypter VB.NET

Mar 25th, 2015
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.56 KB | None | 0 0
  1. Public Function SimpleCrypt( _
  2.        ByVal Text As String) As String
  3.   ' Encrypts/decrypts the passed string using
  4.   ' a simple ASCII value-swapping algorithm
  5.   Dim strTempChar As String, i As Integer
  6.   For i = 1 To Len(Text)
  7.     If Asc(Mid$(Text, i, 1)) < 128 Then
  8.       strTempChar = _
  9. CType(Asc(Mid$(Text, i, 1)) + 128, String)
  10.     ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
  11.       strTempChar = _
  12. CType(Asc(Mid$(Text, i, 1)) - 128, String)
  13.     End If
  14.     Mid$(Text, i, 1) = _
  15.         Chr(CType(strTempChar, Integer))
  16.   Next i
  17.   Return Text
  18. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement