Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
daeken
11y ago
0 comments
Share
I don't know the story, but the logic behind it is simple: If you want to guarantee no one depends on GetHashCode staying static between runs of an application, change it all the time.
0 comments
default
newest
oldest
evincarofautumn
11y ago
But now I can circumvent this hack by xoring with ThisAssembly.DailyBuildNumber again. :)
rplnt
11y ago
I think the story is even simpler than that as the code in question is prefaced with: #if DEBUG
The shipped product doesn't include this "randomness".
MichaelGG
11y ago
Also is it not for hash collision protection, which can end up hurting the runtime of many algorithms, causing a DoS?
plorkyeran
11y ago
No, it has no effect on hash collisions. Two hashes that are equal before being xored with the daily build number will still be equal afterwards.
porges
11y ago
It won't help much there as the number is static for a particular build.
munificent
11y ago
The hash randomization for security is above this part of the code.
j
/
k
navigate · click thread line to collapse