Exemplo n.º 1
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
                                       TpmRh.Owner,              // Hierarchy for ticket (not used here)
                                       out validation);          // Ticket (not used in this example)
            Console.WriteLine("Hashed data (Hash): " + BitConverter.ToString(hashData));
        }