Cryptography

  • Thread starter Thread starter JF Bouthillier
  • Start date Start date
J

JF Bouthillier

Hi all,

I have a table with employee numbers which I need to
modify because it is confidential information. How can I
convert a number (ex. 2654708) to ...

add 5 to the first digit
add 2 to the second digit
add 0 to the third digit
and so on...

Thank you very much.
JF
 
Not quite the scheme you asked for, but try this

Function EncryptPW(ByVal str1 As String) As String

Dim intLen As Integer
str1 = Trim(str1)
intLen = Len(str1)
EncryptPW = ""
Dim X As Integer
For X = 1 To intLen
EncryptPW = EncryptPW & Chr(Asc(Mid(str1, X, 1)) + (35 + (intLen * 3
+ X)))
Next X

End Function
Function DecryptPW(ByVal str1 As String) As String

Dim intLen As Integer
str1 = Trim(str1)
intLen = Len(str1)
DecryptPW = ""
Dim X As Integer
For X = 1 To intLen
DecryptPW = DecryptPW & Chr(Asc(Mid(str1, X, 1)) - (35 + (intLen * 3
+ X)))
Next X

End Function

We use it and it stores gibberish, but works great.

HTH,

Randy
 
Back
Top