C# Class Tpm2Lib.TpmHash

Inheritance: TpmStructureBase, ISignatureUnion
ファイルを表示 Open project: Microsoft/TSS.MSR Class Usage Examples

Private Properties

Property Type Description
ISignatureUnion TpmAlgId
ToStringInternal void
TpmHash System

Public Methods

Method Description
AllOnesHash ( TpmAlgId alg ) : TpmHash

Return a TpmHash of the specified algorithm with value set to 0x01010101... Note that this is not a 'real' hash value, but is the initialization value of some resettable PCR

BlockSize ( TpmAlgId hashAlg ) : ushort

Return the hash function block size in bytes

DigestSize ( TpmAlgId hashAlg ) : ushort

Return the length of the output of the hash function in bytes

Equals ( Object obj ) : bool
Event ( byte dataToExtend ) : TpmHash

Replace the hash value with the hash of the concatenation of the current hash value and DataToExtend

Extend ( Object objectToExtend ) : TpmHash

Replace the hash value with the hash of the concatenation of the current value and the TPM representation of objectToExtend

FromData ( TpmAlgId hashAlg, byte dataToHash ) : TpmHash

Return a new TpmHash set to the hash of the supplied data

FromObject ( TpmAlgId hashAlg, Object data ) : TpmHash

Make a new TpmHash from the hash of the TPM representation of data

FromRandom ( TpmAlgId hashAlg ) : TpmHash

Return a new TpmHash that is the hash of random data

FromString ( TpmAlgId hashAlg, string password ) : TpmHash

Return a TpmHash that is the hash of Encoding.Unicode.GetBytes(password)

GetHashCode ( ) : int
GetUnionSelector ( ) : TpmAlgId
TpmHash ( ) : System

Create a new TpmHash with no associated hash algorithm (generally this should only be used prior to object de-serialization)

TpmHash ( TpmAlgId hashAlgId ) : System

Create an all-zeroes TpmHash with the named hash algorithm

TpmHash ( TpmAlgId hashAlg, byte digest ) : System

Create a TpmHash from the provided digest and hash algorithm. The number of bytes in the digest must match the hash size.

ZeroHash ( TpmAlgId alg ) : TpmHash

Return a TpmHash of specified algorithm set to all zeroes

operator ( ) : bool

Returns true if the two hashes are equal, i.e. if both hash algorithms and digests are the same. When this operator is used to compare a hash object with a byte buffer representing digest, the latter is converted to a hash object with its hash algorithm set to null, which excludes the algorithms from comparison).

Private Methods

Method Description
ISignatureUnion ( ) : TpmAlgId
ToStringInternal ( TpmStructPrinter p ) : void
TpmHash ( byte digest ) : System

Create a TpmHash from the provided digest. Intended to be used by the conversion from byte[] operator to construct temporary object hash objects for the purposes of comparison.

Method Details

AllOnesHash() public static method

Return a TpmHash of the specified algorithm with value set to 0x01010101... Note that this is not a 'real' hash value, but is the initialization value of some resettable PCR
public static AllOnesHash ( TpmAlgId alg ) : TpmHash
alg TpmAlgId
return TpmHash

BlockSize() public static method

Return the hash function block size in bytes
public static BlockSize ( TpmAlgId hashAlg ) : ushort
hashAlg TpmAlgId
return ushort

DigestSize() public static method

Return the length of the output of the hash function in bytes
public static DigestSize ( TpmAlgId hashAlg ) : ushort
hashAlg TpmAlgId
return ushort

Equals() public method

public Equals ( Object obj ) : bool
obj Object
return bool

Event() public method

Replace the hash value with the hash of the concatenation of the current hash value and DataToExtend
public Event ( byte dataToExtend ) : TpmHash
dataToExtend byte
return TpmHash

Extend() public method

Replace the hash value with the hash of the concatenation of the current value and the TPM representation of objectToExtend
public Extend ( Object objectToExtend ) : TpmHash
objectToExtend Object
return TpmHash

FromData() public static method

Return a new TpmHash set to the hash of the supplied data
public static FromData ( TpmAlgId hashAlg, byte dataToHash ) : TpmHash
hashAlg TpmAlgId
dataToHash byte
return TpmHash

FromObject() public static method

Make a new TpmHash from the hash of the TPM representation of data
public static FromObject ( TpmAlgId hashAlg, Object data ) : TpmHash
hashAlg TpmAlgId
data Object
return TpmHash

FromRandom() public static method

Return a new TpmHash that is the hash of random data
public static FromRandom ( TpmAlgId hashAlg ) : TpmHash
hashAlg TpmAlgId
return TpmHash

FromString() public static method

Return a TpmHash that is the hash of Encoding.Unicode.GetBytes(password)
public static FromString ( TpmAlgId hashAlg, string password ) : TpmHash
hashAlg TpmAlgId
password string
return TpmHash

GetHashCode() public method

public GetHashCode ( ) : int
return int

GetUnionSelector() public method

public GetUnionSelector ( ) : TpmAlgId
return TpmAlgId

TpmHash() public method

Create a new TpmHash with no associated hash algorithm (generally this should only be used prior to object de-serialization)
public TpmHash ( ) : System
return System

TpmHash() public method

Create an all-zeroes TpmHash with the named hash algorithm
public TpmHash ( TpmAlgId hashAlgId ) : System
hashAlgId TpmAlgId
return System

TpmHash() public method

Create a TpmHash from the provided digest and hash algorithm. The number of bytes in the digest must match the hash size.
public TpmHash ( TpmAlgId hashAlg, byte digest ) : System
hashAlg TpmAlgId Hash algorithm used to compute digest
digest byte Byte array representing digest
return System

ZeroHash() public static method

Return a TpmHash of specified algorithm set to all zeroes
public static ZeroHash ( TpmAlgId alg ) : TpmHash
alg TpmAlgId
return TpmHash

operator() public static method

Returns true if the two hashes are equal, i.e. if both hash algorithms and digests are the same. When this operator is used to compare a hash object with a byte buffer representing digest, the latter is converted to a hash object with its hash algorithm set to null, which excludes the algorithms from comparison).
public static operator ( ) : bool
return bool