SSN Algorithm Encryption

C

Craig

I need to create a basic algorithm that converts a SSN into a pseudo
encrypted format.

For example (NOTE these are not actual characters it’s just an
example…)
A=1
B=2
C=3
D=4
E=5
F=6
G=7
H=8
I=9
J=0
K=”-“

So, when someone enters 123-45-6789 into a form the code converts the
number to ABCKDEKFGHIJ and stores it in a table. Anyone know of some
example code on how to do this? I’m assuming it should be relatively
straight forward.
 
B

Banana

Craig said:
I need to create a basic algorithm that converts a SSN into a pseudo
encrypted format.

Here's an excellent site that discuss and demonstrate many different
encryptions, and has some visual basic code you can adapt into your project.

http://www.di-mgt.com.au/crypto.html

Be aware, though, all efforts to encrypt will be utterly useless if the
unauthorized people can easily access the encryption key. In an answer
to a similar question, I suggested using Windows filesystem to deny
permissions for non-users to the file containing the SSN as more
effective solution short of going to a server-based RDBMS.

HTH.
 
A

Arvin Meyer [MVP]

How about just encrypting it. That way if you fire someone, before you do,
you can run the function in a query to decrypt the entire field and change
the keyword (strCode). Here's the code. which both encrypts and decrypts:

Public Function EncryptSSN(ByVal strIn As String, ByVal strCode As String)
As String
On Error GoTo Error_Handler

Dim i As Integer
Dim bytData As Byte
Dim bytKey As Byte
Dim strEncrypted As String

EncryptSSN = vbNullString

For i = 1 To Len(strIn)
bytData = Asc(Mid(strIn, i, 1))
bytKey = Asc(Mid(strCode, (i Mod Len(strCode)) + 1))
strEncrypted = strEncrypted & Chr(bytData Xor bytKey)
Next i

If strEncrypted <> vbNullString Then
EncryptSSN = strEncrypted
End If

Exit_Here:
Exit Function

Error_Handler:
Resume Exit_Here
End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I need to create a basic algorithm that converts a SSN into a pseudo
encrypted format.

For example (NOTE these are not actual characters it’s just an
example…)
A=1
B=2
C=3
D=4
E=5
F=6
G=7
H=8
I=9
J=0
K=”-“

So, when someone enters 123-45-6789 into a form the code converts the
number to ABCKDEKFGHIJ and stores it in a table. Anyone know of some
example code on how to do this? I’m assuming it should be relatively
straight forward.
 

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