Return to Snippet

Revision: 12385
at March 12, 2009 17:08 by blackf0rk


Initial Code
Public Function EncryptString(ByVal InSeed As Integer, ByVal InString As String) As String
   Dim c1 As Integer
   Dim NewEncryptString As String
   Dim EncryptSeed As Integer
   Dim EncryptChar As String

   NewEncryptString = ""
   EncryptSeed = InSeed
   For c1 = 1 To Len(InString)
      EncryptChar = Mid(InString, c1, 1)
      EncryptChar = Chr(Asc(EncryptChar) Xor EncryptSeed)
      EncryptSeed = EncryptSeed Xor c1
      NewEncryptString = NewEncryptString & EncryptChar
   Next

   EncryptString = NewEncryptString
End Function

Initial URL
http://codefinds.blogspot.com/2009/01/simple-string-encryption.html

Initial Description
Passing in a seed and your string will return an encrypted string. Pass in the same seed and the encrypted string again and it will return the original unencrypted string.

Initial Title
Simple String Encryption

Initial Tags
simple

Initial Language
VB.NET