Reverse Engineering String.GetHashCode

后端 未结 4 1298
梦毁少年i
梦毁少年i 2021-01-06 08:17

String.GetHashCode\'s behavior is depend on the program architecture. So it will return one value in x86 and one value on x64. I have a test application which must run in x8

4条回答
  •  -上瘾入骨i
    2021-01-06 09:06

    First off, Jon is correct; this is a fool's errand. The internal debug builds of the framework that we use to "eat our own dogfood" change the hash algorithm every day precisely to prevent people from building systems -- even test systems -- that rely on unreliable implementation details that are documented as subject to change at any time.

    Rather than enshrining an emulation of a system that is documented as being not suitable for emulation, my recommendation would be to take a step back and ask yourself why you're trying to do something this dangerous. Is it really a requirement?

    Second, StackOverflow is a technical question and answer site, not a "do my job for me for free" site. If you are hell bent on doing this dangerous thing and you need someone who can rewrite unsafe code into equivalent safe code then I recommend that you hire someone who can do that for you.

提交回复
热议问题