sign hash refactor