[DDC-2166] Refactor identity hash generation

This work prepares for the merge of GH-232, allowing more complex and robust identifier hash generation.