SHA-256. More...
#include "check.h"Defines | |
| #define | rotr_32(num, amount) ((num) >> (amount) | (num) << (32 - (amount))) |
| #define | blk0(i) (W[i] = data[i]) |
| #define | blk2(i) |
| #define | Ch(x, y, z) (z ^ (x & (y ^ z))) |
| #define | Maj(x, y, z) ((x & y) | (z & (x | y))) |
| #define | a(i) T[(0 - i) & 7] |
| #define | b(i) T[(1 - i) & 7] |
| #define | c(i) T[(2 - i) & 7] |
| #define | d(i) T[(3 - i) & 7] |
| #define | e(i) T[(4 - i) & 7] |
| #define | f(i) T[(5 - i) & 7] |
| #define | g(i) T[(6 - i) & 7] |
| #define | h(i) T[(7 - i) & 7] |
| #define | R(i) |
| #define | S0(x) (rotr_32(x, 2) ^ rotr_32(x, 13) ^ rotr_32(x, 22)) |
| #define | S1(x) (rotr_32(x, 6) ^ rotr_32(x, 11) ^ rotr_32(x, 25)) |
| #define | s0(x) (rotr_32(x, 7) ^ rotr_32(x, 18) ^ (x >> 3)) |
| #define | s1(x) (rotr_32(x, 17) ^ rotr_32(x, 19) ^ (x >> 10)) |
Functions | |
| static void | transform (uint32_t state[static 8], const uint32_t data[static 16]) |
| static void | process (lzma_check_state *check) |
| void | lzma_sha256_init (lzma_check_state *check) |
| Prepare SHA-256 state for new input. | |
| void | lzma_sha256_update (const uint8_t *buf, size_t size, lzma_check_state *check) |
| Update the SHA-256 hash state. | |
| void | lzma_sha256_finish (lzma_check_state *check) |
| Finish the SHA-256 calculation and store the result to check->buffer.u8. | |
Variables | |
| static const uint32_t | SHA256_K [64] |
SHA-256.
| #define blk2 | ( | i | ) |
(W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \
+ s0(W[(i - 15) & 15]))
| #define R | ( | i | ) |
h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] \
+ (j ? blk2(i) : blk0(i)); \
d(i) += h(i); \
h(i) += S0(a(i)) + Maj(a(i), b(i), c(i))
| void lzma_sha256_init | ( | lzma_check_state * | check | ) |
Prepare SHA-256 state for new input.
References lzma_check_state::state.
Referenced by lzma_check_init().
| void lzma_sha256_update | ( | const uint8_t * | buf, | |
| size_t | size, | |||
| lzma_check_state * | check | |||
| ) |
Update the SHA-256 hash state.
References lzma_check_state::buffer, and lzma_check_state::state.
Referenced by lzma_check_update().
| void lzma_sha256_finish | ( | lzma_check_state * | check | ) |
Finish the SHA-256 calculation and store the result to check->buffer.u8.
References lzma_check_state::buffer, and lzma_check_state::state.
Referenced by lzma_check_finish().
const uint32_t SHA256_K[64] [static] |
{
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2,
}
1.7.1