CodeChecksumPragma.ChecksumAlgorithmId 屬性

定義

取得或設定 GUID,該 GUID 識別要使用的總和檢查碼演算法。Gets or sets a GUID that identifies the checksum algorithm to use.

public:
 property Guid ChecksumAlgorithmId { Guid get(); void set(Guid value); };
public Guid ChecksumAlgorithmId { get; set; }
member this.ChecksumAlgorithmId : Guid with get, set
Public Property ChecksumAlgorithmId As Guid

屬性值

Guid,其識別要使用的總和檢查碼演算法。A Guid that identifies the checksum algorithm to use.

範例

下列程式碼範例顯示ChecksumAlgorithmId屬性的設定。The following code example shows the setting of the ChecksumAlgorithmId property. 這個程式碼範例是針對CodeChecksumPragma類別提供之較大範例的一部分。This code example is part of a larger example provided for the CodeChecksumPragma class.

pragma1.ChecksumAlgorithmId = HashMD5;
pragma1.ChecksumAlgorithmId = HashMD5

備註

系統會針對 MD5 和 SHA1 雜湊提供演算法。Algorithms are provided for the MD5 and SHA1 hashes. 用於 MD5 雜湊的 GUID 值為 {0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99}。The GUID value to use for the MD5 hash is {0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99}. 要用於 SHA1 雜湊的 GUID 是 {0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60}。The GUID to use for the SHA1 hash is {0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60}.

總和檢查碼的計算是語言特定的。The calculation of the checksum is language-specific. 也就是說, 語言廠商可以使用偵錯工具已知的任何雜湊演算法來計算總和檢查碼。That is, the language vendor can use any of the hashing algorithms known to the debugger to calculate the checksum. 使用此屬性的 GUID 會提供雜湊演算法擴充性。The use of a GUID for this property provides hash algorithm extensibility.

由於 SHA1 和 MD5 的衝突問題, Microsoft 建議以 SHA256 或更佳為基礎的安全性模型。Due to collision problems with SHA1 and MD5, Microsoft recommends a security model based on SHA256 or better.

適用於