identifier: add proper equals() and hashCode()

This should fix #2.