registry: add UnitHash to published UnitStates

This introduces a new field in UnitStates containing the string representing
the Hash of the associated Unit, to disambiguate between UnitStates published
with the same name but actually representing different Units.
Doh, that means we do need the lock for the whole function as I first had, because we also call getunitstate