Hash method and testing class