Re: BSD license compatible hash algorithm?
- From: "Aryeh M. Friedman" <aryeh.friedman@xxxxxxxxx>
- Date: Fri, 28 Dec 2007 07:42:15 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ivan Voras wrote:
Garrett Cooper wrote:
Looks promising, but how difficult would it be to port the code
to other platforms (Win32 for instance?).
The hash algorithm itself as implemented in hash.h is pretty much a
text-book hash algorithm (D.J.Bernstein's):
#ifndef HASHINIT
#define HASHINIT 5381
#define HASHSTEP(x,c) (((x << 5) + x) + (c))
#endif
/*
* Return a 32-bit hash of the given buffer. The init
* value should be 0, or the previous hash value to extend
* the previous hash.
*/
static __inline uint32_t
hash32_buf(const void *buf, size_t len, uint32_t hash)
{
const unsigned char *p = buf;
while (len--)
hash = HASHSTEP(hash, *p++);
return hash;
}
It apparently has some weaknesses if used on binary (non-text) data
but I don't see why it wouldn't work on Windows.
All hashs have issues with pooling.... see
http://www.burtleburtle.net/bob/hash/index.html... btw it is a old
wives tale that the number of buckets should be prime (mostly based on
the very weak implementation Knuth offered)
- --
Aryeh M. Friedman
FloSoft Systems
http://www.flosoft-systems.com
Developer, not business, friendly
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHdO8mzIOMjAek4JIRApb6AJ93JNR1sIPg6mH4TrOCEUn2jfdinwCeI/UO
IQLG9bX1N5PHxsSALDS7dzw=
=saZk
-----END PGP SIGNATURE-----
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: BSD license compatible hash algorithm?
- From: Dag-Erling Smørgrav
- Re: BSD license compatible hash algorithm?
- From: Ivan Voras
- Re: BSD license compatible hash algorithm?
- From: Aryeh M. Friedman
- Re: BSD license compatible hash algorithm?
- References:
- BSD license compatible hash algorithm?
- From: Garrett Cooper
- Re: BSD license compatible hash algorithm?
- From: Brooks Davis
- Re: BSD license compatible hash algorithm?
- From: Garrett Cooper
- Re: BSD license compatible hash algorithm?
- From: Ivan Voras
- BSD license compatible hash algorithm?
- Prev by Date: Re: BSD license compatible hash algorithm?
- Next by Date: Re: BSD license compatible hash algorithm?
- Previous by thread: Re: BSD license compatible hash algorithm?
- Next by thread: Re: BSD license compatible hash algorithm?
- Index(es):
Relevant Pages
- Re: retrieve the key from a map
... The key here is the word "Hash" in HashMap. ... A good hash algorithm
... Each Object in java has an overrideable hashCode() method which is ... string.
... (comp.lang.java.programmer) - Re: RIPEMD -160 using .NET
... You are correct that paper of Wang describes attack on original ... hashes
and is based on unbalanced feistel networks. ... And there is another hash algorithm Whirlpool
... (microsoft.public.dotnet.security) - Re: Newbie: is there "A no need to remember the key" algorithm
... If the hash algorithm is any good, ... >turn passphrases into encryption
keys. ... Every algorithm needs to protect against known plain text attack. ...
(sci.crypt) - Re: Local Sam
... The analogy I like to use is a DNA test - you can use it to verify who's ...
I've seen other analogies - such as talking about hash functions as turning ... the right
hash - even if you know the hash and the hash algorithm, ... > True that weakly choosen
passwords can be obtained with ... (microsoft.public.security) - Re: Maximum String size in Java?
... > His SFH hash algorithm seems to be extremely fast, ... This means experimenting
with ... I just don't know whether SFH is a useful idea or not. ... (comp.programming)