|
|
|
|
|
by selljamhere
2935 days ago
|
|
>>New hashing algorithm >>Hash values vary from run to run (so don’t depend on hash values or order) I must be reading this wrong. One of the requirements for a good hash function is determinism - specifically that any given value in the input space maps to exactly one value in the output space. |
|
with some explanation for where the seed comes from here:
https://github.com/apple/swift/blob/master/stdlib/public/cor...
Within that code you will see references to Core which by default is this:
https://github.com/apple/swift/blob/82226642c2459c0f5d2054fe...
So you can see the hash function itself is deterministic given the seed it is initialized with. And the seed is generated at process start time during static initialization in C++ so it is effectively a constant for the lifetime of the process.
You can see in the code that there is a way to make hashing fully deterministic by making the seed generation not use random numbers, but it is ill-advised for a variety of security reasons.