realbasic-nug
[Top] [All Lists]

Re: Doh! Variant.Hash is case insenstive

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Doh! Variant.Hash is case insenstive
From: Phil M <phil at mobleybros dot com>
Date: Wed, 30 Nov 2005 19:20:24 -0800
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <BFB3C43B dot 5C96%Roph at kc dot rr dot com>
On Nov 30, 2005, at 7:03 PM, Roph wrote:

This would probably have a little better distribution characteristics, especially for short strings and run at a comparable speed to what I proposed.

MemoryBlocks are usually quicker than string manipulations, but your function looked pretty optimized in that regard.

I like the LittleEndian tweak for cross-platform compatibility,

You can't forget about cross-platform compatibility!  =)

Actually you have to have the Little-Endian value defined because of the UShort. Besides giving a better distribution, it also runs almost twice as fast in REALbasic as grabbing each byte.

and I was unaware that Bitwise offered a ShiftLeft method -- nice to know.

There is a OnesComplement too, but no TwosComplement.

I don't see that using "prime numbers" here as opposed to just "moderate size numbers" really gains you anything of consequence, but combining that with the Mod 65521 gets you the better distribution for small strings.

This was just a modified Adler-32 Checksum. I think the normal Adler-32 starts with a=1 and b=0 with an option parameter for a to take a different value. I just added the prime numbers for a and b to give short strings a kick-start.

So, yeah.  I could live with this just fine if coded in C.

I am sure that you can find plenty of examples of C/C++ source code for this type of algorithm and you can try the REALbasic Plugin SDK to make a plugin out of it.

You know I just checked and the Adler-32 Checksum is part of the Einhugur e-CryptIt Engine... so there you go. =)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>