Refactor hashing functionality into new module