noc*_*cab 1 c# hash cryptography hashcode
的文档提到使用“随机种子” ,HashCode“仅在操作系统进程的范围内具有确定性”。
我的问题是:
让我们来看看。的来源HashCode 在这里。我们可以看到这一行:
private static readonly uint s_seed = GenerateGlobalSeed();
Run Code Online (Sandbox Code Playgroud)
那么让我们看一下GenerateGlobalSeed:
private static unsafe uint GenerateGlobalSeed()
{
uint result;
Interop.GetRandomBytes((byte*)&result, sizeof(uint));
return result;
}
Run Code Online (Sandbox Code Playgroud)
好的,并且Interop.GetRandomBytes:
Sys.GetNonCryptographicallySecureRandomBytes(buffer, length);
Run Code Online (Sandbox Code Playgroud)
那里有相当大的赠品:NonCryptographyallySecure RandomBytes。这不是加密来源。
如果我们进一步查看实现,我们可以看到它使用arc4random_bufor lrand48,这绝对不是加密的。
即使种子是加密的,请注意它在整个过程中都是恒定的。弄清楚它是什么并不是特别困难,具体取决于您要防范的攻击类型。
| 归档时间: |
|
| 查看次数: |
559 次 |
| 最近记录: |