Hash function and test improvements.