Simple String Encryption

/ Published in: VB.NET
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  1. Public Function EncryptString(ByVal InSeed As Integer, ByVal InString As String) As String
  2. Dim c1 As Integer
  3. Dim NewEncryptString As String
  4. Dim EncryptSeed As Integer
  5. Dim EncryptChar As String
  7. NewEncryptString = ""
  8. EncryptSeed = InSeed
  9. For c1 = 1 To Len(InString)
  10. EncryptChar = Mid(InString, c1, 1)
  11. EncryptChar = Chr(Asc(EncryptChar) Xor EncryptSeed)
  12. EncryptSeed = EncryptSeed Xor c1
  13. NewEncryptString = NewEncryptString & EncryptChar
  14. Next
  16. EncryptString = NewEncryptString
  17. End Function


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.