ProtectText + UnProtectText

Encrypt or decrypt text, simple encryption with a numeric password
Decrypt a string, convert it to "77 96 105 105 106 "

CodeFunctionName
What is this?

Public

Tested

Original Work
Function UnProtectText(sText, iPwd)
' Pwd is a numeric password = Enc = Encrypt number
Dim NewStr, Enc, OldI
Enc = iPwd ' 5
NewStr = "": OldI = 1
For I = 1 To Len(sText)
mimi = Mid(sText, I, 1)
If mimi = " " Then
mimi = Mid(sText, OldI, I - OldI)
NewStr = NewStr & Chr(Val(mimi) Xor Enc)
OldI = I
End If
Next I
UnProtectText = NewStr
End Function
Function ProtectText(sText, iPwd)
' Encrypt a string and convert it from "77 96 105 105 106 "
' Pwd is a numeric password/key = Enc = Encrypt number
Dim NewStr, Enc
Enc = iPwd ' 5
NewStr = ""
For I = 1 To Len(sText)
mimi = Mid(sText, I, 1)
NewStr = NewStr & Str(Asc(mimi) Xor Enc)
Next I
ProtectText = NewStr
End Function

sText, iPwd

Views 4,493

Downloads 1,460

CodeID
DB ID