Cryptography

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
 
R

Randy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top