0

Are there any cryptographically secure hash functions that can be given a array of strings to hash, and will always calculate the same output no matter what order the array elements are in?

I realize that one could merge the array elements into one string and hash that, but I'm asking specifically about functions that are order-independent (like bloom filters) but cryptographically secure (unlike bloom filters)

user229044
  • 232,980
  • 40
  • 330
  • 338
Lev Knoblock
  • 611
  • 2
  • 6
  • 20

2 Answers2

0

Sort the array, apply whatever your favorite encoding is to convert the array into one string, and apply a standard cryptographic hash.

user2357112
  • 260,549
  • 28
  • 431
  • 505
  • I'm asking about the theoretical existence of such a function for a case where multiple individuals cannot sort a set, or do not know how it should be sorted. – Lev Knoblock Mar 30 '18 at 18:43
  • Mathematically, aren't we talking about imposing *some* sort of order in any case, otherwise the hash function won't output the same result? – Tripp Kinetics Mar 30 '18 at 18:45
  • Well that's why I'm asking if such a thing exists. The closest parallel I can think of is a bloom filter, but those are far from cryptographically secure. – Lev Knoblock Mar 30 '18 at 18:47
0

After asking the same question on the Cryptography StackExchange, I was referred to this question which described Multiset Hash Functions, specifically the MSet-Mu-Hash and MSet-VAdd-Hash functions: https://crypto.stackexchange.com/questions/54544/how-to-to-calculate-the-hash-of-an-unordered-set

Lev Knoblock
  • 611
  • 2
  • 6
  • 20