Connecting Tech Pros Worldwide Forums | Help | Site Map

Scrambling text to create a unique identifier

MLH
Guest
 
Posts: n/a
#1: Nov 13 '05
I have a 50-char job name field (text type) in an Access
table. The entries into this field will be unique. No two
records will house the same job name.

I would like an algorithm that would churn out an 8-char
(A-Z domain) unique text code based on the seed value
provided by the unique input string contained in the job
name field. I'm not looking for 128-bit encryption tech-
nology here - just something the average secretary type
user wouldn't likely be able to unscramble on her coffee
break. Was hoping to do this with Access Basic in an
Access 2.0 application.

Most important to me is that unique job name strings be
scrambled into correspondingly unique 8-char ID codes.
I wouldn't want the following 2 job names to somehow
be resolved to the same code...

"Renovation for the McCoy residence"
"Renovation for he Hatfield log cabin"

So, there it is. Ideas? Solutions?

MGFoster
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Scrambling text to create a unique identifier


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Could try the ole XOR trick (use debug window):

The seed is "z" - turns "A," Chr$(65), into Chr$(59), semi-colon.
? asc("A") xor asc("z")
59

Use the seed on the "converted" character to get the original
? asc("z") xor 59
65

Use a loop to convert a string to an "encrypted" string:

Function encrypt(str As String)

Const strSeed = "z"

Dim i As Integer
Dim strEncrypt As String

For i = 1 To Len(str)
strEncrypt = strEncrypt & _
Chr$(Asc(Mid$(str, i, 1)) Xor Asc(strSeed))
Next i

encrypt = strEncrypt

End Function

Usage:
' encrypt
str = "abcde"
debug.print encrypt(str) ' -> yields 5 square chars

' decrypt - str now holds encrypted string
debug.print encrypt(str) ' -> yields "abcde"

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQiaTCYechKqOuFEgEQJJNwCglWCeyC70vfJzP7dZiiXTXG n4LM0An1lD
iG0zhVE84S8mCkNgYjNd7BJt
=oIPq
-----END PGP SIGNATURE-----


MLH wrote:[color=blue]
> I have a 50-char job name field (text type) in an Access
> table. The entries into this field will be unique. No two
> records will house the same job name.
>
> I would like an algorithm that would churn out an 8-char
> (A-Z domain) unique text code based on the seed value
> provided by the unique input string contained in the job
> name field. I'm not looking for 128-bit encryption tech-
> nology here - just something the average secretary type
> user wouldn't likely be able to unscramble on her coffee
> break. Was hoping to do this with Access Basic in an
> Access 2.0 application.
>
> Most important to me is that unique job name strings be
> scrambled into correspondingly unique 8-char ID codes.
> I wouldn't want the following 2 job names to somehow
> be resolved to the same code...
>
> "Renovation for the McCoy residence"
> "Renovation for he Hatfield log cabin"
>
> So, there it is. Ideas? Solutions?[/color]
Tom van Stiphout
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Scrambling text to create a unique identifier


On Wed, 02 Mar 2005 23:05:06 -0500, MLH <CRCI@NorthState.net> wrote:

There would be no need for the secretary to use her brain to
descramble your code. He/She can just read the plaintext job name.

-Tom.

[color=blue]
>I have a 50-char job name field (text type) in an Access
>table. The entries into this field will be unique. No two
>records will house the same job name.
>
>I would like an algorithm that would churn out an 8-char
>(A-Z domain) unique text code based on the seed value
>provided by the unique input string contained in the job
>name field. I'm not looking for 128-bit encryption tech-
>nology here - just something the average secretary type
>user wouldn't likely be able to unscramble on her coffee
>break. Was hoping to do this with Access Basic in an
>Access 2.0 application.
>
>Most important to me is that unique job name strings be
>scrambled into correspondingly unique 8-char ID codes.
>I wouldn't want the following 2 job names to somehow
>be resolved to the same code...
>
>"Renovation for the McCoy residence"
>"Renovation for he Hatfield log cabin"
>
>So, there it is. Ideas? Solutions?[/color]

MLH
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Scrambling text to create a unique identifier


Correct. But I'm OK with her knowing the job name. I don't want
her to be able to pull up the Job Notes Editing Form unless she
knows the code.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Thu, 03 Mar 2005 07:31:55 -0700, Tom van Stiphout
<no.spam.tom7744@cox.net> wrote:
[color=blue]
>On Wed, 02 Mar 2005 23:05:06 -0500, MLH <CRCI@NorthState.net> wrote:
>
>There would be no need for the secretary to use her brain to
>descramble your code. He/She can just read the plaintext job name.
>
>-Tom.[/color]

Closed Thread