# Best practice to hash multiple attributes

I have to generate a signature for concatenation of multiple independent values say A | B | C. Two options are :

1. concatenate all attributes and generate the hash. Then Sign hash.

$$signature = Sign\big(Hash(A\mathbin\| B \mathbin\| C)\big)$$

1. Use hash of previous value along with current value to generate the hash. Sign the generated hash.

$$signature = Sign\big(Hash\big(Hash\big(Hash(A)\mathbin\| B) \mathbin\| C)\big)\big)\big)$$

Analogous to taking two hashes of a value, option 2 seems cryptographically strong. Kindly help in picking right practice and why?

• Not sure but i will choose the first one for performance reasons, in the case your system is high intense on CPU. In terms of crypto I think both are strong and safe. Mar 18, 2020 at 9:50
• Just wondering, what prevents one from splitting one value into 3 and use the second approach? If Hash is SHA-1 then the 1. can be insecure as of 2020. Mar 18, 2020 at 10:58