diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-16 22:57:56 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-16 22:57:56 (GMT) |
commit | 16a95636a32fd3f5f16ec37370060222673085a5 (patch) | |
tree | 92a43f36d4b10489b100b541e7c76a2fb875791c /src/H5checksum.c | |
parent | 84bf19bec42e2c53114727df2e239aa3fecb1071 (diff) | |
download | hdf5-16a95636a32fd3f5f16ec37370060222673085a5.zip hdf5-16a95636a32fd3f5f16ec37370060222673085a5.tar.gz hdf5-16a95636a32fd3f5f16ec37370060222673085a5.tar.bz2 |
[svn-r12768] Description:
Add 'initval' parameter to "lookup3" checksum routine (and implicitly to
the metadata checksum routine), to allow chaining several checksums together
easily (which isn't used by these modules, but will be used in my next checkin)
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5checksum.c')
-rw-r--r-- | src/H5checksum.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/H5checksum.c b/src/H5checksum.c index 98260ef..39ff065 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -359,7 +359,7 @@ use a bitmask. For example, if you need only 10 bits, do In which case, the hash table should have hashsize(10) elements. If you are hashing n strings (uint8_t **)k, do it like this: - for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); + for (i=0, h=0; i<n; ++i) h = H5_checksum_lookup( k[i], len[i], h); By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this code any way you wish, private, educational, or commercial. It's free. @@ -370,7 +370,7 @@ acceptable. Do NOT use for cryptographic purposes. */ uint32_t -H5_checksum_lookup3(const void *key, size_t length /*, uint32_t initval */) +H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) { const uint8_t *k = (const uint8_t *)key; uint32_t a, b, c; /* internal state */ @@ -382,7 +382,7 @@ H5_checksum_lookup3(const void *key, size_t length /*, uint32_t initval */) HDassert(length > 0); /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)length) /* + initval */; + a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) @@ -445,7 +445,7 @@ done: *------------------------------------------------------------------------- */ uint32_t -H5_checksum_metadata(const void *data, size_t len) +H5_checksum_metadata(const void *data, size_t len, uint32_t initval) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5_checksum_metadata) @@ -455,6 +455,6 @@ H5_checksum_metadata(const void *data, size_t len) /* Choose the appropriate checksum routine */ /* (use Bob Jenkin's "lookup3" algorithm for all buffer sizes) */ - FUNC_LEAVE_NOAPI(H5_checksum_lookup3(data, len)) + FUNC_LEAVE_NOAPI(H5_checksum_lookup3(data, len, initval)) } /* end H5_checksum_metadata() */ |