MurmurHash3

Marc Schütz via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Dec 20 03:04:35 PST 2015


On Saturday, 19 December 2015 at 22:15:14 UTC, Guillaume Chatelet 
wrote:
> The last version of the code is available here and is feature 
> complete AFAICT
> https://github.com/gchatelet/murmurhash3_d/blob/master/murmurhash3.d
>
> Last concern, I declared blockSize in bytes where 
> std.digest.digest says it should be in bits. Why does it need 
> to be bits ? It looks like HMAC (which needs it) is explicitly 
> making sure it's always a multiple of 8 bits.

I was the one who introduced it, and I chose bits instead of 
bytes because I didn't want to exclude the possibility that there 
are hashing algos that have a block size not divisible by 8. The 
algorithms are usually described in terms of bits, not bytes, so 
it's not unconceivable that such hash functions exist, though I 
don't know any. (Of course, HMAC wouldn't work with those, but 
that doesn't mean that other algorithms couldn't.)

I'd suggest you change `blockSize` to the number of bits, and 
introduce an enum `blockSizeInBytes` for internal use.


More information about the Digitalmars-d-announce mailing list