refactored hashcheck