| 1 | /* |
| 2 | * An implementation of the SHA-256 hash function. |
| 3 | * |
| 4 | * The Federal Information Processing Standards (FIPS) Specification |
| 5 | * can be found here (FIPS 180-3): |
| 6 | * http://csrc.nist.gov/publications/PubsFIPS.html |
| 7 | * |
| 8 | * Written in 2010 by Lorenz Quack <[email protected]> |
| 9 | * |
| 10 | * =================================================================== |
| 11 | * The contents of this file are dedicated to the public domain. To |
| 12 | * the extent that dedication to the public domain is not available, |
| 13 | * everyone is granted a worldwide, perpetual, royalty-free, |
| 14 | * non-exclusive license to exercise all rights associated with the |
| 15 | * contents of this file for any purpose whatsoever. |
| 16 | * No rights are reserved. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 25 | * SOFTWARE. |
| 26 | * =================================================================== |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #define MODULE_NAME SHA256 |
| 31 | #define DIGEST_SIZE (256/8) |
| 32 | #define WORD_SIZE 4 |
| 33 | |
| 34 | #include "common.h" |
| 35 | |
| 36 | /* Initial Values H */ |
| 37 | static const uint32_t H[8] = { |
| 38 | 0x6a09e667, |
| 39 | 0xbb67ae85, |
| 40 | 0x3c6ef372, |
| 41 | 0xa54ff53a, |
| 42 | 0x510e527f, |
| 43 | 0x9b05688c, |
| 44 | 0x1f83d9ab, |
| 45 | 0x5be0cd19 |
| 46 | }; |
| 47 | |
| 48 | #include "hash_SHA2_template.c" |