Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Hash Class

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

Namespace:  System.Security.Policy
Assembly:  mscorlib (in mscorlib.dll)
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class Hash : EvidenceBase, ISerializable

The Hash type exposes the following members.

  NameDescription
Public methodHashInitializes a new instance of the Hash class.
Top
  NameDescription
Public propertyMD5Gets the MD5 hash value for the assembly.
Public propertySHA1Gets the SHA1 hash value for the assembly.
Public propertySHA256Gets the SHA256 hash value for the assembly.
Top
  NameDescription
Public methodCloneCreates a new object that is a copy of the current instance. (Overrides EvidenceBase.Clone().)
Public methodStatic memberCreateMD5Creates a Hash object that contains an MD5 hash value.
Public methodStatic memberCreateSHA1Creates a Hash object that contains a SHA1 hash value.
Public methodStatic memberCreateSHA256Creates a Hash object that contains a SHA256 hash value.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGenerateHashComputes the hash value for the assembly using the specified hash algorithm.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetObjectDataGets the SerializationInfo object with the parameter name and additional exception information.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string representation of the current Hash. (Overrides Object.ToString().)
Top

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.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.