Refactored hasher tests

While refactoring the tests I discovered a bug which causes
PasswordHasher to raise KeyErrors for invalid hashes which I resolved to
make the tests pass.