# Concatenating hashes

I am thinking about to concatenate two hashes, but I was searched about this and I have questions, if some one should help me. Thank you

I have two strings str1 and str2 with variable large. I need obtain a hash of these, but when I was searched I read about problems with collisions and I don't understand that.

In this moment I think that this is sufficient.

cipher = hash(str1) || hash(str2)

But according to other opinions is necessary add other injective function to prevent resistance collisions. That approach looks like this:

cipher = hash(hash(str1) || hash(str2))

What do you think?

EDIT

I use murmur3 with 128.

I have many data and I need to represent this whit hashes, because that I use hash function.

With the time I use the first approach but many collisions have appeared and I don't understand why. I think because I use murmur3 of 128 to everything data or I don't know.

• I would use SHA384 with the 2nd approach. if I am not mistaken, murmur3 is maybe about as collision resistant as md5, and substantially less so if you want to introduce an intentional collision, it is not a cryptographic hash Jun 15 '18 at 23:37
• Sorry, but what type is this? Jun 16 '18 at 9:27
• murmur3 is designed to simply verify that one piece of data is different from another within a specific probability, without the constraint that someone might attack the scheme in which it is used. It is good for hash tables, think of it more like a 128-bit checksum Jun 17 '18 at 0:35
• also, the probability of collision is higher with a smaller hash function, which is why I suggested SHA384, which is more than a trillion trillion trillion times less likely to have a collision compared to murmur3 Jun 17 '18 at 0:38
• MD5 has a $2^{18}$ complexity two-block collision attack. Murmur hash is not even designed to be collision resistant. It's probably closer to that of MD4 in terms of collision resistance. Jun 17 '18 at 2:50