private Hash ( byte data, TpmAlgId hashAlg, TpmHandle hierarchy, [ validation ) : byte[] | ||
data | byte | |
hashAlg | TpmAlgId | |
hierarchy | TpmHandle | |
validation | [ | |
return | byte[] |
int IEqualityComparer <byte[]> .GetHashCode(byte[] obj) { TkHashcheck validation; return(BitConverter.ToInt32(my_tpm.Hash(obj as byte[], TpmAlgId.Sha1, TpmRh.Owner, out validation), 0)); }
/// <summary> /// Very simple hash calculation. /// We ask the TPM to calculate the hash of a 3-byte array. /// </summary> /// <param name="tpm">Reference to the TPM object.</param> static void SimpleHash(Tpm2 tpm) { TkHashcheck validation; byte[] hashData = tpm.Hash(new byte[] { 1, 2, 3 }, // Data to hash TpmAlgId.Sha256, // Hash algorithm TpmHandle.RhOwner, // Hierarchy for ticket (not used here) out validation); // Ticket (not used in this example) Console.WriteLine("Hashed data (Hash): " + BitConverter.ToString(hashData)); }