VB Code:
  1. Private Function InvertString(sT As String) As String
  2. Dim sTT As String
  3.  
  4. For I = Len(sT) To 1 Step -1
  5. sTT = sTT & Mid(sT, I, 1)
  6. Next
  7.  
  8. InvertString = sTT
  9.  
  10. End Function
  11.  
  12. Private Function Encrypt(sT As String, sKey As String) As String
  13. Dim sEncrypted As String
  14. Dim keyCount As Integer
  15.  
  16. sT = InvertString(sT)
  17. sKey = InvertString(sKey)
  18. keyCount = 1
  19. For I = 1 To Len(sT)
  20. sEncrypted = sEncrypted & Chr(Asc(Mid(sT, I, 1)) + Mid(sKey, keyCount, 1))
  21. keyCount = keyCount + 1
  22. If keyCount > Len(sKey) Then keyCount = 1
  23. Next
  24.  
  25. Encrypt = sEncrypted
  26.  
  27. End Function
  28.  
  29. Private Function Decrypt(sT As String, sKey As String) As String
  30. Dim sDecrypted As String
  31. Dim keyCount As Integer
  32.  
  33. sKey = InvertString(sKey)
  34. keyCount = 1
  35.  
  36. For I = 1 To Len(sT)
  37. sDecrypted = sDecrypted & Chr(Asc(Mid(sT, I, 1)) - Mid(sKey, keyCount, 1))
  38. keyCount = keyCount + 1
  39. If keyCount > Len(sKey) Then keyCount = 1
  40. Next
  41.  
  42. Decrypt = InvertString(sDecrypted)
  43.  
  44. End Function

Just use, Encrypt() And Decrypt() - remember to pass the same key!!