Separated the hashing logic into a class method.