SHA-256 source code


The source code for the SHA-256 algorithm, also called SHA256, SHA2 or SHA-2. This source code is part of the PolarSSL library and represents the most current version in the trunk of the library.
Download PolarSSL

The full algorithm of SHA-256 is further explained in SHA-256 algorithm (Wikipedia).

In addition to being used for the SHA-256 algorithm, the same code also performs the SHA-224 algorithm. In fact, the SHA-224 hash algorithm is nothing more than the result of the SHA-256 algorithm being cut short.

The code only has a single dependency on config.h in the sha2.c source code file. You can remove this inclusion or just create a simple header file to define one or more of the configuration options that the SHA-256 source code has.

Full documentation on the SHA-256 source code can be found in the API documentation for the SHA-2 module.

You can also download it as part of the latest release of PolarSSL.

Header - sha2.h

The sha2.h header can also be found in the trunk on: sha2.h.

Source - sha2.c

The sha2.c source code can also be found in the trunk on: sha2.c.