eddelbuettel/digest — pull request #3 by jimhester (2014-12-04 16:55:31+00:00)
Title: Initial implementation of xxhash support.

This pull request provides support for [xxHash](https://github.com/Cyan4973/xxHash) hash function. It is a non-cryptographic hash function whose main feature is that it is extremely fast.

This pull request currently contains a simple initial implementation. I wanted to make sure it looks ok and that you would be willing to accept it before fleshing out the documentation/etc. Also there are a few more features I could add if you thought they would be worthwhile.

1. xxHash has two flavors, `XXH64` which returns a 64 bit unsigned long long, and `XXH32` which returns a 32bit unsigned long. The 64 bit version is very fast on 64 bit architectures, but a fair amount slower on 32 bit. Likewise the 32bit version is fast on 32 bit architectures and slower on 64bit. The current implementation is only the 64 bit version, however it would not be hard to add the 32 bit as well following the `SHA1, SHA256` model you have established.
2. xxHash lets you input a seed to the hash, so it would be nice to allow this to be user configurable from `digest()` (so they could generate longer hashes from the same input for instance). Right now the seed is hardcoded to be `0`.

I apologize for all the extraneous whitespace changes in the pull, my editor automatically fixes trailing whitespace.

Also if you are curious about the real world speed I calculated a hash of the human reference genome `Hg18` with xxHash and sha1, as you can see it is very fast!
```r
system.time(digest('~/Hg18.fa', 'sha1', file = TRUE))
#> user system elapsed
#> 10.523 0.762 11.286

system.time(digest('~/Hg18.fa', 'xxHash', file = TRUE))
#> user system elapsed
#> 0.585 0.690 1.275
```