OpenPassword + ClosePassword

Encrypt / Decrypt a string, convert it to "77 96 105 105 106" or back to regular string using an encryption number (Enc)

Function OpenPassword(ClosedPassword, Enc)
' Needs Enc = Encrypt number
 Dim NewStr, Enc, OldI
 Enc = 5
 NewStr = "": OldI = 1
 For I = 1 To Len(ClosedPassword)
  mimi = Mid(ClosedPassword, I, 1)
  If mimi = " " And NewStr>"" Then
   mimi = Mid(ClosedPassword, OldI, I - OldI)
   NewStr = NewStr & Chr(Val(mimi) Xor Enc)
   OldI = I
  End If
 Next I
 OpenPassword = NewStr
End Function
Function ClosePassword(OpenedPassword,Enc)
' Encrypt a string and convert it from "77 96 105 105 106 "
' Needs Enc = Encrypt number
' And add a space in the end of string (For Decrypting)
 Dim NewStr, Enc
 Enc = 5
 NewStr = ""
 For I = 1 To Len(OpenedPassword)
  mimi = Mid(OpenedPassword, I, 1)
  NewStr = NewStr & Str(Asc(mimi) Xor Enc)
 Next I
 ClosePassword = NewStr & " "
End Function

ClosedPassword, Enc
or
OpenedPassword,Enc

Views 636 Downloads 237

'encrypt', 'decrypt', 'pwd', 'password', 'Enc'

ANmarAmdeen
326
Protection Classic ASP
Revisions

v1.0