2015-10-07 39 views

回答

3

檢查反編譯的代碼,它只是清除了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進行施工。看起來更像是一個重置按鈕。

0

從CoreCLR:

[System.Security.SecuritySafeCritical] // auto-generated 
    public override void Initialize() { 
     if (_safeHashHandle != null && !_safeHashHandle.IsClosed) 
      _safeHashHandle.Dispose(); 

     // _CreateHash will check for failures and throw the appropriate exception 
     _safeHashHandle = Utils.CreateHash(Utils.StaticProvHandle, Constants.CALG_SHA1); 
    } 

它看起來被稱爲的HashAlgorihthm方法標準實現的一部分,並沒有像以往任何時候都需要正常使用過程中直接調用。

相關問題