Visible to Intel only — GUID: GUID-76D0F627-5502-4D06-A1CB-C84482A11723
Visible to Intel only — GUID: GUID-76D0F627-5502-4D06-A1CB-C84482A11723
Hash Functions
Functions described in this section apply hash algorithms to digesting streaming messages.
Usage model of the generalized hash functions is similar to the model explained below.
A primitive implementing a hash algorithm uses the state context IppsHashState as an operational vehicle to carry all necessary variables to manage the computation of the chaining digest value.
The following example illustrates how the application code can apply the implemented SHA-1 hash standard to digest the input message stream.
Call the function HashGetSize to get the size required to configure the IppsHashState context.
Ensure that the required memory space is properly allocated. With the allocated memory, call the HashInit function with the value of hashAlg equal to ippHashAlg_SHA1 to set up the initial context state with the SHA-1 specified initialization vectors.
Keep calling the function HashUpdate to digest incoming message stream in the queue till its completion. To determine the current value of the digest, call HashGetTag between the two calls to HashUpdate.
Call the function HashFinal to pad the partial block into a final SHA-1 message block and transform it into a 160-bit message digest value.
Clean up secret data stored in the context.
Call the operating system memory free service function to release the IppsSHA1StateIppsHashState context.
The IppsHashState context is position-dependent. The HashPack, HashUnpack functions transform this context to a position-independent form and vice versa.
Important
The crypto community does not consider SHA-1 or MD5 algorithms secure anymore.Recommendation: use a more secure hash algorithm (for example, any algorithm from the SHA-2 family) instead of SHA-1 or MD5.
Related Information
- HashGetSize
- HashInit
- HashPack, HashUnpack
- HashDuplicate
- HashUpdate
- HashFinal
- HashGetTag
- HashMethod
- HashMethodSet
- HashStateMethodSet
- HashMethodGetSize
- SM3GetSize
- SM3Init
- SM3Pack, SM3Unpack
- SM3Duplicate
- SM3Update
- SM3Final
- SM3GetTag
- MD5GetSize
- MD5Init
- MD5Pack, MD5Unpack
- MD5Duplicate
- MD5Update
- MD5Final
- MD5GetTag
- SHA1GetSize
- SHA1Init
- SHA1Pack, SHA1Unpack
- SHA1Duplicate
- SHA1Update
- SHA1Final
- SHA1GetTag
- SHA224GetSize
- SHA224Init
- SHA224Pack, SHA224Unpack
- SHA224Duplicate
- SHA224Update
- SHA224Final
- SHA224GetTag
- SHA256GetSize
- SHA256Init
- SHA256Pack, SHA256Unpack
- SHA256Duplicate
- SHA256Update
- SHA256Final
- SHA256GetTag
- SHA384GetSize
- SHA384Init
- SHA384Pack, SHA384Unpack
- SHA384Duplicate
- SHA384Update
- SHA384Final
- SHA384GetTag
- SHA512GetSize
- SHA512Init
- SHA512Pack, SHA512Unpack
- SHA512Duplicate
- SHA512Update
- SHA512Final
- SHA512GetTag