dedup hash merge logic