hash optimization