HashAlgorithm

HashAlgorithmdisposable

System.Security.Cryptography (mscorlib.dll)abstract class
public abstract class HashAlgorithm : ICryptoTransform, IDisposable { // Protected Constructors    protected HashAlgorithm(  ); // Protected Instance Fields    protected int HashSizeValue;    protected byte[  ] HashValue;    protected int State; // Public Instance Properties    public virtual bool CanReuseTransform{get;  // implements ICryptoTransform    public virtual bool CanTransformMultipleBlocks{get;  // implements ICryptoTransform    public virtual byte[  ] Hash{get; }    public virtual int HashSize{get; }    public virtual int InputBlockSize{get;  // implements ICryptoTransform    public virtual int OutputBlockSize{get;  // implements ICryptoTransform // Public Static Methods    public static HashAlgorithm Create(  );    public static HashAlgorithm Create(string hashName); // Public Instance Methods    public void Clear(  );    public byte[  ] ComputeHash(byte[  ] buffer);    public byte[  ] ComputeHash(byte[  ] buffer, int offset, int count);    public byte[  ] ComputeHash(System.IO.Stream inputStream);    public abstract void Initialize(  );    public int TransformBlock(byte[  ] inputBuffer,  int inputOffset,         int inputCount, byte[  ] outputBuffer, int outputOffset); // implements ICryptoTransform    public byte[  ] TransformFinalBlock(byte[  ] inputBuffer, int inputOffset, int inputCount); // implements ICryptoTransform // Protected Instance Methods    protected virtual void Dispose(bool disposing);    protected abstract void HashCore(byte[  ] array, int ibStart, int cbSize);    protected abstract byte[  ] HashFinal(  ); }

A hash algorithm processes data to create a fixed-length string, known as a hash code. Hash algorithms are useful because it is difficult to find two sets of data that result in the same hash code; hash algorithms are an important part of the process to create digital signatures and are used to ensure data integrity.

All hash algorithm implementations inherit from this abstract class. Implementation classes are instantiated using the Create( ) method, which accepts the name of an implementation as a String argument. The default algorithm is created if no implementation name is specified; the system administrator can configure the default algorithm.

The ComputeHash( ) method generates a hash code by either processing a Byte array or by reading data from a Stream.

Subclasses

KeyedHashAlgorithm, MD5, SHA1, SHA256, SHA384, SHA512

Returned By

SignatureDescription.CreateDigest( ), System.Security.Policy.HashMembershipCondition.HashAlgorithm

Passed To

AsymmetricSignatureDeformatter.VerifySignature( ), AsymmetricSignatureFormatter.CreateSignature( ), System.Security.Policy.Hash.GenerateHash( ), System.Security.Policy.HashMembershipCondition.{HashAlgorithm, HashMembershipCondition( )}



Programming. NET Security
Programming .Net Security
ISBN: 0596004427
EAN: 2147483647
Year: 2005
Pages: 346

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net