Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Slightly Off Topic
Thu, Apr 1 2010 1:24 PMPermanent Link

Terry Swiers

Hi All,

I've got a situation where I need to calculate a hash value for a set of
values and be able to determine if those values have been changed by
recalculating the hash and comparing it to the original.  The hard part is
that I need to be able to do this regardless of the order of the values,
such that the calculated hash of  "ABC,1,29.99,EFG,2,19,99"  is the same as
"EFG,2,19,99,ABC,1,29.99".

Anyone ever seen or done anything like this that could point me in the right
direction?

--

---------------------------------------
 Terry Swiers
 Millennium Software, Inc.
 http://www.1000years.com
 http://www.atrex.com

 The Atrex 13 beta is now available.
 Visit http://v13beta.atrex.com for more information.

Atrex Electronic Support Options:
 Atrex Knowledgebase: http://www.atrex.com/atrexkb.asp
 Email: mailto:support@atrex.com
 Newsgroup: news://news.1000years.com/millennium.atrex
 Fax: 1-925-829-1851
 Phone: 1-925-828-5892 (M-F, 9a-5p Pacific)
 ---------------------------------------

Thu, Apr 1 2010 2:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Terry,

<< I've got a situation where I need to calculate a hash value for a set of
values and be able to determine if those values have been changed by
recalculating the hash and comparing it to the original.  The hard part is
that I need to be able to do this regardless of the order of the values,
such that the calculated hash of  "ABC,1,29.99,EFG,2,19,99"  is the same as
"EFG,2,19,99,ABC,1,29.99". >>

I would simply sort the values, and then use a hash like MurmurHash2:

http://sites.google.com/site/murmurhash/

https://forums.embarcadero.com/thread.jspa?threadID=13902

In the second link, I would use the Delphi code by Lionel Delafosse.  It
seems to be the best.   Be sure to change any PChar references to PAnsiChar
or PByte if using Delphi 2009 or higher.

You could also use an MD5 or CRC32 calculation, both of which are in
ElevateDB already in the edbcommon.pas unit.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 1 2010 6:31 PMPermanent Link

Terry Swiers

Tim,

> I would simply sort the values, and then use a hash like MurmurHash2:
>
> http://sites.google.com/site/murmurhash/
>
> https://forums.embarcadero.com/thread.jspa?threadID=13902
>
> In the second link, I would use the Delphi code by Lionel Delafosse.  It
> seems to be the best.   Be sure to change any PChar references to
> PAnsiChar or PByte if using Delphi 2009 or higher.
>
> You could also use an MD5 or CRC32 calculation, both of which are in
> ElevateDB already in the edbcommon.pas unit.

Thanks for the pointers.  It is greatly appreciated.

--

---------------------------------------
 Terry Swiers
 Millennium Software, Inc.
 http://www.1000years.com
 http://www.atrex.com

 The Atrex 13 beta is now available.
 Visit http://v13beta.atrex.com for more information.

Atrex Electronic Support Options:
 Atrex Knowledgebase: http://www.atrex.com/atrexkb.asp
 Email: mailto:support@atrex.com
 Newsgroup: news://news.1000years.com/millennium.atrex
 Fax: 1-925-829-1851
 Phone: 1-925-828-5892 (M-F, 9a-5p Pacific)
 ---------------------------------------

Image