gpt4 book ai didi

c# - (何时)是否需要调用 SHA1Managed.Initialize()?

转载 作者:行者123 更新时间:2023-11-30 16:05:53 27 4
gpt4 key购买 nike

SHA1Managed.Initialize() 实际上做了什么?什么时候需要调用它? The documentation非常稀疏。

最佳答案

检查反编译代码,它只是清除了 bufferexpandedBuffer 字节数组:

public override void Initialize()
{
this.InitializeState();
Array.Clear((Array) this._buffer, 0, this._buffer.Length);
Array.Clear((Array) this._expandedBuffer, 0, this._expandedBuffer.Length);
}

为了简洁起见,InitializeState方法,也是在构造函数中调用的:

private void InitializeState()
{
this._count = 0L;
this._stateSHA1[0] = 1732584193U;
this._stateSHA1[1] = 4023233417U;
this._stateSHA1[2] = 2562383102U;
this._stateSHA1[3] = 271733878U;
this._stateSHA1[4] = 3285377520U;
}

构造时无需调用Initialize。看起来更像是一个重置按钮。

关于c# - (何时)是否需要调用 SHA1Managed.Initialize()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33002738/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com