Hash and Signature Algorithms

The following algorithms compute hashes and digital signatures. Each of these algorithms is supported in the Microsoft Base, Strong, and Enhanced Cryptographic Providers. Internal details of these algorithms are beyond the scope of this documentation. For a list of additional sources, refer to Additional Documentation on Cryptography.


Cipher Block Chaining (CBC) MAC

One of the algorithms (CALG_MAC) implemented by Microsoft providers is a block cipher Message Authentication Code (MAC). This method encrypts the base data with a block cipher and then uses the last encrypted block as the hash value. The encryption algorithm used to build the MAC is the one that was specified when the session key was created.


An algorithm (CALG_HMAC) implemented by Microsoft providers. This algorithm also uses a symmetric key to create the hash, but is more complex than the simple Cipher Block Chaining (CBC) MAC algorithm. It can be used with any iterated cryptographic hash algorithm, such as MD5 or SHA-1. For details, see Creating an HMAC.

MD2, MD4, and MD5

These hashing algorithms were all developed by RSA Data Security, Inc. These algorithms were developed in sequential order. All three generate 128-bit hash values. All three are known to have weaknesses and should only be used where needed for compatibility purposes. For new code, we recommend the SHA-2 family of hashes.

These algorithms are well known and can be reviewed in detail in any reference on cryptography.

Message Authentication Code (MAC)

MAC algorithms are similar to hash algorithms, but are computed by using a symmetric (session) key. The original session key is required to recompute the hash value. The recomputed hash value is used to verify that the base data was not changed. These algorithms are sometimes called keyed-hash algorithms. To see which Microsoft providers support MAC, see Microsoft Cryptographic Service Providers.

Secure Hash Algorithm (SHA-1)

This hashing algorithm was developed by the National Institute of Standards and Technology (NIST) and by the National Security Agency (NSA). This algorithm was developed for use with DSA (Digital Signature Algorithm) or DSS (Digital Signature Standard). This algorithm generates a 160-bit hash value. SHA-1 is known to have weaknesses, and should only be used where required for compatibility purposes. For new code, we recommend the SHA-2 family of hashes.

Secure Hash Algorithm - 2 (SHA-2)

This hashing algorithm was developed as a successor to SHA-1 by the National Institute of Standards and Technology (NIST) and the National Security Agency (NSA). It has four variants—SHA-224, SHA-256, SHA-384, and SHA-512—which are named according to the number of bits in their outputs. Of these, SHA-256, SHA-384, and SHA-512 are implemented in the Microsoft AES Cryptographic Provider.

SSL3 Client Authorization Algorithm

This algorithm is used for SSL3 client authentication. In the SSL3 protocol, a concatenation of an MD5 hash and a SHA hash is signed with an RSA private key. CryptoAPI 2.0 and the Microsoft Base and Enhanced Cryptographic Providers support this with the hash type CALG_SSL3_SHAMD5. For more information, see Creating a CALG_SSL3_SHAMD5 Hash.