Share via


MD5CryptoServiceProvider 類別

定義

警告

Derived cryptographic types are obsolete. Use the Create method on the base type instead.

使用密碼編譯服務提供者 (CSP) 所提供之實作,計算輸入資料的 MD5 雜湊值。 此類別無法獲得繼承。

public ref class MD5CryptoServiceProvider sealed : System::Security::Cryptography::MD5
public sealed class MD5CryptoServiceProvider : System.Security.Cryptography.MD5
[System.Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class MD5CryptoServiceProvider : System.Security.Cryptography.MD5
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class MD5CryptoServiceProvider : System.Security.Cryptography.MD5
type MD5CryptoServiceProvider = class
    inherit MD5
[<System.Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type MD5CryptoServiceProvider = class
    inherit MD5
[<System.Runtime.InteropServices.ComVisible(true)>]
type MD5CryptoServiceProvider = class
    inherit MD5
Public NotInheritable Class MD5CryptoServiceProvider
Inherits MD5
繼承
MD5CryptoServiceProvider
屬性

備註

哈希函式會將任意長度的二進位字串對應至固定長度的小型二進位字串。 密碼編譯哈希函式具有無法計算的 屬性,可尋找哈希為相同值的兩個不同輸入;也就是說,如果對應的數據也相符,則兩組數據集的哈希應該相符。 數據的小變更會導致哈希中發生大型、無法預測的變更。

注意

有較新的哈希函式,例如安全哈希演算法 SHA-256 和 SHA-512。 請考慮使用 SHA256 類別或 類別, SHA512 而不是類別 MD5CryptoServiceProvider 。 僅用於 MD5CryptoServiceProvider 與舊版應用程式和數據的相容性。

類別的 MD5CryptoServiceProvider 哈希大小為128位。

類別 ComputeHash 的方法 MD5CryptoServiceProvider 會將哈希傳回為16個字節的陣列。 請注意,某些 MD5 實作會產生 32 個字元的十六進位格式哈希。 若要與這類實作互操作,請將方法的 ComputeHash 傳回值格式化為十六進位值。

建構函式

MD5CryptoServiceProvider()
已淘汰.

初始化 MD5CryptoServiceProvider 類別的新執行個體。

欄位

HashSizeInBits
已淘汰.

MD5 演算法所產生的哈希大小,以位為單位。

(繼承來源 MD5)
HashSizeInBytes
已淘汰.

MD5 演算法所產生的哈希大小,以位元組為單位。

(繼承來源 MD5)
HashSizeValue
已淘汰.

代表計算出來之雜湊碼的大小,以位元為單位。

(繼承來源 HashAlgorithm)
HashValue
已淘汰.

表示計算出來的雜湊碼的值。

(繼承來源 HashAlgorithm)
State
已淘汰.

表示雜湊計算的狀態。

(繼承來源 HashAlgorithm)

屬性

CanReuseTransform
已淘汰.

取得值,表示目前的轉換是否可重複使用。

(繼承來源 HashAlgorithm)
CanTransformMultipleBlocks
已淘汰.

在衍生類別中覆寫時,取得值以指出是否有多個區塊可被轉換。

(繼承來源 HashAlgorithm)
Hash
已淘汰.

取得計算出來之雜湊碼的值。

(繼承來源 HashAlgorithm)
HashSize
已淘汰.

取得計算出來之雜湊碼的大小,以位元為單位。

(繼承來源 HashAlgorithm)
InputBlockSize
已淘汰.

在衍生類別中覆寫時,取得輸入區塊的大小。

(繼承來源 HashAlgorithm)
OutputBlockSize
已淘汰.

在衍生類別中覆寫時,取得輸出區塊的大小。

(繼承來源 HashAlgorithm)

方法

Clear()
已淘汰.

釋放 HashAlgorithm 類別所使用的所有資源。

(繼承來源 HashAlgorithm)
ComputeHash(Byte[])
已淘汰.

計算指定位元組陣列的雜湊值。

(繼承來源 HashAlgorithm)
ComputeHash(Byte[], Int32, Int32)
已淘汰.

計算所指定位元組陣列中指定區域的雜湊值。

(繼承來源 HashAlgorithm)
ComputeHash(Stream)
已淘汰.

計算指定 Stream 物件的雜湊值。

(繼承來源 HashAlgorithm)
ComputeHashAsync(Stream, CancellationToken)
已淘汰.

以非同步方式計算指定 Stream 物件的雜湊值。

(繼承來源 HashAlgorithm)
Dispose()
已淘汰.

釋放 HashAlgorithm 類別目前的執行個體所使用的全部資源。

(繼承來源 HashAlgorithm)
Dispose(Boolean)
已淘汰.

釋放 HashAlgorithm 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

(繼承來源 HashAlgorithm)
Equals(Object)
已淘汰.

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Finalize()
已淘汰.

釋放 MD5CryptoServiceProvider 正在使用的資源。

GetHashCode()
已淘汰.

做為預設雜湊函式。

(繼承來源 Object)
GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
HashCore(Byte[], Int32, Int32)
已淘汰.

在衍生類別中覆寫時,將寫入物件的資料轉遞到用來計算雜湊的雜湊演算法。

(繼承來源 HashAlgorithm)
HashCore(ReadOnlySpan<Byte>)
已淘汰.

將寫入物件的資料路由傳送至雜湊演算法,以用來計算雜湊。

(繼承來源 HashAlgorithm)
HashFinal()
已淘汰.

於衍生類型中覆寫時,在密碼編譯雜湊演算法處理最後一筆資料後,完成雜湊計算。

(繼承來源 HashAlgorithm)
Initialize()
已淘汰.

初始化 MD5CryptoServiceProvider 的執行個體。

MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()
已淘汰.

傳回代表目前物件的字串。

(繼承來源 Object)
TransformBlock(Byte[], Int32, Int32, Byte[], Int32)
已淘汰.

計算輸入位元組陣列中指定區域的雜湊值,並將指定的輸入位元組陣列區域複製到指定的輸出位元組陣列區域。

(繼承來源 HashAlgorithm)
TransformFinalBlock(Byte[], Int32, Int32)
已淘汰.

計算所指定位元組陣列中指定區域的雜湊值。

(繼承來源 HashAlgorithm)
TryComputeHash(ReadOnlySpan<Byte>, Span<Byte>, Int32)
已淘汰.

嘗試計算指定位元組陣列的雜湊值。

(繼承來源 HashAlgorithm)
TryHashFinal(Span<Byte>, Int32)
已淘汰.

在雜湊演算法處理最後一筆資料之後,嘗試完成雜湊計算。

(繼承來源 HashAlgorithm)

明確介面實作

IDisposable.Dispose()
已淘汰.

釋放 HashAlgorithm 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

(繼承來源 HashAlgorithm)

適用於

另請參閱