Add support for user-specified hash functions,
write some docs and add tests.