Hash Functions

Functions featured in this section apply hash algorithms to digesting streaming messages. A primitive implementing a hash algorithm uses the state context (for example, ippsSHA1State) as an operational vehicle to carry all necessary variables to manage the computation of the chaining digest value. For example, the primitive implementing the SHA-1 hash algorithm must use the ippsSHA1State context.

The function Init initializes (MD5Init, SHA1Init, SHA224Init, SHA256Init, SHA384Init, and SHA512Init) the context and sets up specified initialization vectors. Once initialized, the function Update (MD5Update, SHA1Update, SHA224Update, SHA256Update, SHA384Update, and SHA512Update) digests the input message stream with the selected hash algorithm till it exhausts all message blocks. The function Final (MD5Final, SHA1Final, SHA224Final, SHA256Final, SHA384Final, and SHA512Final) is designed to pad the partial message block into a final message block with the specified padding scheme, and then uses the hash algorithm to transform the final block into a message digest value.

The following example illustrates how the application code can apply the implemented SHA-1 hash standard to digest the input message stream.


  1. Call the function SHA1GetSize to get the size required to configure the ippsSHA1State context.

  2. Ensure that the required memory space is properly allocated. With the allocated memory, call the SHA1Init function to set up the initial context state with the SHA-1 specified initialization vectors.

  3. Keep calling the function SHA1Update to digest incoming message stream in the queue till its completion. To determine the current value of the digest, call SHA1GetTag between the two calls to SHA1Update.

  4. Call the function SHA1Final for padding the partial block into a final SHA-1 message block and transforming it into a 160-bit message digest value.

  5. Call the operating system memory free service function to release the ippsSHA1State context.

The contexts used by the hash primitives (for example, ippsSHA1State) are position-dependent. The following functions transform the respective position-dependent context to a position-independent form and vice versa:


Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.