Thread: ASP.NET/Simple String Encryption in ASP.NET and VB

Simple String Encryption in ASP.NET and VB

www.aspnettutorials.com/tutorials/advanced/string-encrypt-vb.aspx





Re: Simple String Encryption in ASP.NET and VB

Public Function EncryptPassword(ByVal Password As String) As String

Dim PassNew As String

Dim Cntr As Integer

Cntr = 1

Do While Cntr <= Len(Password)

PassNew = CStr(PassNew) & Chr((Asc(Mid(Trim(Password), Cntr, 1)) + 20))

Cntr = Cntr + 1

Loop

EncryptPassword = PassNew

End Function



Public Function DecryptPassword(ByVal Password As String) As String

Dim Cntr As Integer

Dim OldPass As String

Cntr = 1

Do While Cntr <= Len(Password)

OldPass = OldPass + Chr((Asc(Mid(Trim(Password), Cntr, 1)) - 20))

Cntr = Cntr + 1

Loop

DecryptPassword = OldPass

End Function