finish update hash function