Microsoft has a simple encrypt/decrypt routine that you can use from VB and ASP. I've used it to encrypt fields before storing them in a SQL Server database. It's so short, I'll post it here.
You pass it the string you wish to encrypt/decrypt and a password. The first time you pass the string it encrypts. Call it again with the same parameters, it decrypts.
Public Function Encrypt(strInput As String, strPassword As String) As String
Dim L As Integer
Dim X As Integer
Dim Char As Integer
' strInput = the string you wish to encrypt or decrypt.
' strPassword = the password with which to encrypt the string.
L = Len(strPassword)
For X = 1 To Len(strInput)
Char = Asc(Mid$(strPassword, (X Mod L) - L * ((X Mod L) = 0), 1))
Mid$(strInput, X, 1) = Chr$(Asc(Mid$(strInput, X, 1)) Xor Char)
Next
Encrypt = strInput
End Function
Brian J. Alves
Email: brian.alves@worldnet.att.net
VB / ASP / Crystal / SQLServer
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.