1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
9 // Hasher class, performs no allocation and therefore does not throw or return
10 // errors. Usage is as follows:
11 // Create an instance (this initializes the hash).
12 // Add one or more blocks of input data using AddData().
13 // Retrieve the hash using GetHash(). This can be done as many times as desired
14 // until the object is destructed. Once a hash is asked for, further AddData
15 // calls will be ignored. There is no way to reset object state (simply
16 // destroy the object and create another instead).
18 #define SHA1_HASH_SIZE 20 // Number of bytes output by SHA-1
21 DWORD magic_sha1; // Magic value for A_SHA_CTX
22 DWORD awaiting_data[16];
23 // Data awaiting full 512-bit block.
24 // Length (nbit_total[0] % 512) bits.
25 // Unused part of buffer (at end) is zero
26 DWORD partial_hash[5];
27 // Hash through last full block
29 // Total length of message so far
37 BYTE m_Value[SHA1_HASH_SIZE];
40 void SHA1Init(SHA1_CTX*);
41 void SHA1Update(SHA1_CTX*, const BYTE*, const DWORD);
42 void SHA1Final(SHA1_CTX*, BYTE* digest);
46 void AddData(BYTE *pbData, DWORD cbData);