Donovan,
you can use any hash algorithm for this task. The easy way is to calculate a
CRC32.
As alternative I found the hash procedure in sources of DBTables.pas from
Delphi 5 (view a GetHashCode procedure).
Also somewhere I saw the source of Soundex procedure.
Of course, the level of hash depends from task and maybe you needs the
MD5...
With best regards, Mike Shkolnik.
E-Mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
WEB: http://www.scalabium.com
SMComponents Mailing list: http://www.onelist.com/subscribe/SMComponents
> -----Original Message-----
> From: Donovan J. Edye [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, October 18, 2000 5:44 AM
> To: E-List (Delphi); DUG
> Subject: [Delphi] [Q] Convert a given string to a magic number....
>
> G'Day,
>
> Another obscure one. Has anyone got any suggestins on how to turn an
> arbitrary string into a unique number?
>
> Eg 'ab' = 123
> 'ba' = 456
> 'abc' = 1234
>
> etc.
>
> My first thought was
>
> Original String --> Apply MD5 Hash --> StringOfFixed length -->
> MagicStringToNoEncoding = Desired Result
>
> ------------------------------------------------------------------------
> --Donovan [[EMAIL PROTECTED]]
> Donovan J. Edye [www.edye.wattle.id.au]
> Namadgi Systems, Delphi Developer [www.namsys.com.au]
> Voice: +61 2 6285-3460 Fax: +61 2 6285-3459
> TVisualBasic = Class(None);
> Heard just before the 'Big Bang': "...Uh Oh...."
> ------------------------------------------------------------------------
> GXExplorer [http://www.gxexplorer.org] Freeware Windows Explorer
> replacement. Also includes freeware delphi windows explorer components.
> ------------------------------------------------------------------------
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"