refactoring of DirHash class