Uredi

Deli z drugimi prek


Hash Class

Definition

Provides evidence about the hash value for an assembly. This class cannot be inherited.

public ref class Hash sealed : System::Security::Policy::EvidenceBase, System::Runtime::Serialization::ISerializable
public ref class Hash sealed : System::Runtime::Serialization::ISerializable
public sealed class Hash : System.Security.Policy.EvidenceBase, System.Runtime.Serialization.ISerializable
[System.Serializable]
public sealed class Hash : System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class Hash : System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class Hash : System.Security.Policy.EvidenceBase, System.Runtime.Serialization.ISerializable
type Hash = class
    inherit EvidenceBase
    interface ISerializable
[<System.Serializable>]
type Hash = class
    interface ISerializable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Hash = class
    interface ISerializable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Hash = class
    inherit EvidenceBase
    interface ISerializable
Public NotInheritable Class Hash
Inherits EvidenceBase
Implements ISerializable
Public NotInheritable Class Hash
Implements ISerializable
Inheritance
Inheritance
Hash
Attributes
Implements

Remarks

A hash value represents a unique value that corresponds to a particular set of bytes. Rather than referring to an assembly by name, version, or other designation, a hash value designates the assembly without ambiguity. Names are subject to collisions in rare cases where the same name is given to completely different code. Different variations of code can accidentally be marked with the same version. However, even changing a single bit results in a very different hash value.

Hash values are a cryptographically secure way to refer to specific assemblies in policy without the use of digital signatures. A secure hash algorithm is designed so that it is computationally infeasible to construct a different assembly with the identical hash value by either an accidental or malicious attempt. By default, evidence from the SHA1 and MD5 hash algorithms is supported, although any hash algorithm can be used through GenerateHash.

Due to collision problems with MD5 and SHA1, Microsoft recommends a security model based on SHA256 or better.

Constructors

Hash(Assembly)

Initializes a new instance of the Hash class.

Properties

MD5

Gets the MD5 hash value for the assembly.

SHA1

Gets the SHA1 hash value for the assembly.

SHA256

Gets the SHA256 hash value for the assembly.

Methods

Clone()

Creates a new object that is a copy of the current instance.

Clone()

Creates a new object that is a complete copy of the current instance.

(Inherited from EvidenceBase)
CreateMD5(Byte[])

Creates a Hash object that contains an MD5 hash value.

CreateSHA1(Byte[])

Creates a Hash object that contains a SHA1 hash value.

CreateSHA256(Byte[])

Creates a Hash object that contains a SHA256 hash value.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GenerateHash(HashAlgorithm)

Computes the hash value for the assembly using the specified hash algorithm.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext)
Obsolete.

Gets the SerializationInfo object with the parameter name and additional exception information.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string representation of the current Hash.

Applies to