Why not just use hash_compare. Have you had a look at the examples?