Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | WEAK_ALIASING 0 |
#define | LITTLE_ENDIAN 1234 |
#define | BIG_ENDIAN 4321 |
#define | BYTE_ORDER LITTLE_ENDIAN |
#define | SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) |
#define | SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) |
#define | SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) |
#define | REVERSE32(w, x) |
#define | REVERSE64(w, x) |
#define | ADDINC128(w, n) |
#define | R(b, x) ((x) >> (b)) |
#define | S32(b, x) (((x) >> (b)) | ((x) << (32 - (b)))) |
#define | S64(b, x) (((x) >> (b)) | ((x) << (64 - (b)))) |
#define | Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) |
#define | Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
#define | Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) |
#define | Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) |
#define | sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3, (x))) |
#define | sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) |
#define | Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) |
#define | Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) |
#define | sigma0_512(x) (S64(1, (x)) ^ S64(8, (x)) ^ R(7, (x))) |
#define | sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R(6, (x))) |
Variables | |
static const ut32 | K256 [64] |
static const ut32 | sha256_initial_hash_value [8] |
static const ut64 | K512 [80] |
static const ut64 | sha384_initial_hash_value [8] |
static const ut64 | sha512_initial_hash_value [8] |
static const char * | sha2_hex_digits = "0123456789abcdef" |
#define BYTE_ORDER LITTLE_ENDIAN |
#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) |
#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) |
#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) |
Definition at line 597 of file sha2.c.
References len, SHA256_End(), SHA256_Init(), and SHA256_Update().
char* SHA256_End | ( | RZ_SHA256_CTX * | context, |
char | buffer[] | ||
) |
Definition at line 574 of file sha2.c.
References d, i, NULL, rz_mem_memzero(), SHA256_DIGEST_LENGTH, SHA256_Final(), and sha2_hex_digits.
Referenced by SHA256_Data().
void SHA256_Final | ( | ut8 * | digest, |
RZ_SHA256_CTX * | context | ||
) |
Definition at line 503 of file sha2.c.
References context::buffer, d, memcpy(), memset(), p, REVERSE32, REVERSE64, SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, SHA256_SHORT_BLOCK_LENGTH, SHA256_Transform(), and ut64().
Referenced by plugin_sha256_final(), plugin_sha256_small_block(), and SHA256_End().
void SHA256_Init | ( | RZ_SHA256_CTX * | context | ) |
Definition at line 285 of file sha2.c.
References context::buffer, memcpy(), rz_mem_memzero(), SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, and sha256_initial_hash_value.
Referenced by plugin_sha256_init(), plugin_sha256_small_block(), and SHA256_Data().
void SHA256_Transform | ( | RZ_SHA256_CTX * | context, |
const ut32 * | data | ||
) |
Definition at line 385 of file sha2.c.
References a, b, context::buffer, BYTE_ORDER, c, Ch, d, e, f, g, h, K256, LITTLE_ENDIAN, Maj, REVERSE32, s0, s1, Sigma0_256, and Sigma1_256.
Referenced by SHA256_Final(), and SHA256_Update().
void SHA256_Update | ( | RZ_SHA256_CTX * | context, |
const ut8 * | data, | ||
size_t | len | ||
) |
Definition at line 462 of file sha2.c.
References context::buffer, len, memcpy(), SHA256_BLOCK_LENGTH, and SHA256_Transform().
Referenced by plugin_sha256_small_block(), plugin_sha256_update(), and SHA256_Data().
Definition at line 1007 of file sha2.c.
References len, SHA384_End(), SHA384_Init(), and SHA384_Update().
char* SHA384_End | ( | RZ_SHA384_CTX * | context, |
char | buffer[] | ||
) |
Definition at line 982 of file sha2.c.
References d, i, memset(), NULL, sha2_hex_digits, SHA384_DIGEST_LENGTH, and SHA384_Final().
Referenced by SHA384_Data().
void SHA384_Final | ( | ut8 | digest[], |
RZ_SHA384_CTX * | context | ||
) |
Definition at line 951 of file sha2.c.
References d, memcpy(), memset(), REVERSE64, SHA384_DIGEST_LENGTH, SHA512_Last(), and ut64().
Referenced by plugin_sha384_final(), plugin_sha384_small_block(), and SHA384_End().
void SHA384_Init | ( | RZ_SHA384_CTX * | context | ) |
Definition at line 938 of file sha2.c.
References context::buffer, memcpy(), memset(), SHA384_BLOCK_LENGTH, sha384_initial_hash_value, and SHA512_DIGEST_LENGTH.
Referenced by plugin_sha384_init(), plugin_sha384_small_block(), and SHA384_Data().
void SHA384_Update | ( | RZ_SHA384_CTX * | context, |
const ut8 * | data, | ||
size_t | len | ||
) |
Definition at line 947 of file sha2.c.
References len, and SHA512_Update().
Referenced by plugin_sha384_small_block(), plugin_sha384_update(), and SHA384_Data().
Definition at line 929 of file sha2.c.
References len, SHA512_End(), SHA512_Init(), and SHA512_Update().
char* SHA512_End | ( | RZ_SHA512_CTX * | context, |
char | buffer[] | ||
) |
Definition at line 904 of file sha2.c.
References d, i, NULL, rz_mem_memzero(), sha2_hex_digits, SHA512_DIGEST_LENGTH, and SHA512_Final().
Referenced by SHA512_Data().
void SHA512_Final | ( | ut8 | digest[], |
RZ_SHA512_CTX * | context | ||
) |
Definition at line 873 of file sha2.c.
References d, memcpy(), REVERSE64, rz_mem_memzero(), SHA512_DIGEST_LENGTH, SHA512_Last(), and ut64().
Referenced by plugin_sha512_final(), plugin_sha512_small_block(), and SHA512_End().
void SHA512_Init | ( | RZ_SHA512_CTX * | context | ) |
Definition at line 606 of file sha2.c.
References context::buffer, memcpy(), rz_mem_memzero(), SHA512_BLOCK_LENGTH, SHA512_DIGEST_LENGTH, and sha512_initial_hash_value.
Referenced by plugin_sha512_init(), plugin_sha512_small_block(), and SHA512_Data().
void SHA512_Last | ( | RZ_SHA512_CTX * | context | ) |
Definition at line 823 of file sha2.c.
References context::buffer, memset(), p, REVERSE64, SHA512_BLOCK_LENGTH, SHA512_SHORT_BLOCK_LENGTH, SHA512_Transform(), and ut64().
Referenced by SHA384_Final(), and SHA512_Final().
void SHA512_Transform | ( | RZ_SHA512_CTX * | context, |
const ut64 * | data | ||
) |
Definition at line 702 of file sha2.c.
References a, b, context::buffer, BYTE_ORDER, c, Ch, d, e, f, g, h, K512, LITTLE_ENDIAN, Maj, REVERSE64, s0, s1, Sigma0_512, Sigma1_512, and ut64().
Referenced by SHA512_Last(), and SHA512_Update().
void SHA512_Update | ( | RZ_SHA512_CTX * | context, |
const ut8 * | data, | ||
size_t | len | ||
) |
Definition at line 777 of file sha2.c.
References ADDINC128, context::buffer, len, memcpy(), SHA512_BLOCK_LENGTH, SHA512_Transform(), and ut64().
Referenced by plugin_sha512_small_block(), plugin_sha512_update(), SHA384_Update(), and SHA512_Data().
Definition at line 179 of file sha2.c.
Referenced by SHA256_Transform().
Definition at line 211 of file sha2.c.
Referenced by SHA512_Transform().
Definition at line 199 of file sha2.c.
Referenced by SHA256_Init().
|
static |
Definition at line 282 of file sha2.c.
Referenced by SHA256_End(), SHA384_End(), and SHA512_End().
Definition at line 255 of file sha2.c.
Referenced by SHA384_Init().
Definition at line 267 of file sha2.c.
Referenced by SHA512_Init().