https://github.com/dotnet/coreclr/blob/master/src/mscorlib/s...
https://github.com/dotnet/coreclr/blob/master/src/mscorlib/s...
[1]: https://github.com/munificent/wren/blob/master/src/wren_valu...
[2]: https://github.com/dotnet/coreclr/blob/master/src/mscorlib/s...
// We want to ensure we can change our hash function daily.
// This is perfectly fine as long as you don't persist the
// value from GetHashCode to disk or count on String A
// hashing before string B. Those are bugs in your code.
hash1 ^= ThisAssembly.DailyBuildNumber;
I'd love to hear the story behind this one :D
The shipped product doesn't include this "randomness".
The idea is that the hash is good enough for normal list, but it's not a cryptographic hash and it's easy to find collisions. Then you can make a lot of requests with strings that has the same hash value. Now the hash operations are O(N) instead of O(~1) and everything is slower.
Using an unpredictable hash calculation makes this attack more difficult.
>>> (lambda w:w[2:]+w[:2])(''.join(sorted("Phyton",key=lambda c:math.sin(ord(c)^50))))
'Python'http://referencesource.microsoft.com/#mscorlib/system/string...
IE: Environment.GetResourceString("ArgumentOutOfRange_Index")
The string there is in multiple areas of that class, and the same behavior is displayed for all of them. Wouldn't logic suggest everything such as above would be moved in to a constant repository for clarity and also less potential human error for future additions?
http://grepcode.com/file/repository.grepcode.com/java/root/j...
It's sort of surprising to me how much huger the .NET version is, in terms of code. Virtually all the lines in the Java version are API docs. The .NET version doesn't seem to have them (they must be elsewhere?) but it does have a lot more code and that code is much lower level.
Not sure what that means, if anything, but it's interesting.
http://blogs.msdn.com/b/ericlippert/archive/2011/07/19/strin...
This lets them interoperate with OLE Automation.