
Go to the source code of this file.
Data Structures | |
| struct | _SHA256_CTX |
| struct | _SHA512_CTX |
Defines | |
| #define | SHA256_Init pg_SHA256_Init |
| #define | SHA256_Update pg_SHA256_Update |
| #define | SHA256_Final pg_SHA256_Final |
| #define | SHA384_Init pg_SHA384_Init |
| #define | SHA384_Update pg_SHA384_Update |
| #define | SHA384_Final pg_SHA384_Final |
| #define | SHA512_Init pg_SHA512_Init |
| #define | SHA512_Update pg_SHA512_Update |
| #define | SHA512_Final pg_SHA512_Final |
| #define | SHA224_BLOCK_LENGTH 64 |
| #define | SHA224_DIGEST_LENGTH 28 |
| #define | SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1) |
| #define | SHA256_BLOCK_LENGTH 64 |
| #define | SHA256_DIGEST_LENGTH 32 |
| #define | SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) |
| #define | SHA384_BLOCK_LENGTH 128 |
| #define | SHA384_DIGEST_LENGTH 48 |
| #define | SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) |
| #define | SHA512_BLOCK_LENGTH 128 |
| #define | SHA512_DIGEST_LENGTH 64 |
| #define | SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) |
Typedefs | |
| typedef struct _SHA256_CTX | SHA256_CTX |
| typedef struct _SHA512_CTX | SHA512_CTX |
| typedef SHA256_CTX | SHA224_CTX |
| typedef SHA512_CTX | SHA384_CTX |
Functions | |
| void | SHA224_Init (SHA224_CTX *) |
| void | SHA224_Update (SHA224_CTX *, const uint8 *, size_t) |
| void | SHA224_Final (uint8[SHA224_DIGEST_LENGTH], SHA224_CTX *) |
| void | SHA256_Init (SHA256_CTX *) |
| void | SHA256_Update (SHA256_CTX *, const uint8 *, size_t) |
| void | SHA256_Final (uint8[SHA256_DIGEST_LENGTH], SHA256_CTX *) |
| void | SHA384_Init (SHA384_CTX *) |
| void | SHA384_Update (SHA384_CTX *, const uint8 *, size_t) |
| void | SHA384_Final (uint8[SHA384_DIGEST_LENGTH], SHA384_CTX *) |
| void | SHA512_Init (SHA512_CTX *) |
| void | SHA512_Update (SHA512_CTX *, const uint8 *, size_t) |
| void | SHA512_Final (uint8[SHA512_DIGEST_LENGTH], SHA512_CTX *) |
| #define SHA224_DIGEST_LENGTH 28 |
Definition at line 54 of file sha2.h.
Referenced by SHA224_Final().
| #define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1) |
| #define SHA256_BLOCK_LENGTH 64 |
Definition at line 56 of file sha2.h.
Referenced by SHA224_Init(), SHA256_Init(), SHA256_Last(), and SHA256_Update().
| #define SHA256_DIGEST_LENGTH 32 |
Definition at line 57 of file sha2.h.
Referenced by SHA224_Init(), SHA256_Final(), and SHA256_Init().
| #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) |
| #define SHA256_Final pg_SHA256_Final |
Definition at line 44 of file sha2.h.
Referenced by int_sha256_finish(), and md_result().
| #define SHA256_Init pg_SHA256_Init |
Definition at line 42 of file sha2.h.
Referenced by int_sha256_reset(), and md_init().
| #define SHA256_Update pg_SHA256_Update |
Definition at line 43 of file sha2.h.
Referenced by int_sha256_update(), md_update(), and SHA224_Update().
| #define SHA384_BLOCK_LENGTH 128 |
Definition at line 59 of file sha2.h.
Referenced by SHA384_Init().
| #define SHA384_DIGEST_LENGTH 48 |
Definition at line 60 of file sha2.h.
Referenced by SHA384_Final().
| #define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) |
| #define SHA384_Final pg_SHA384_Final |
Definition at line 47 of file sha2.h.
Referenced by int_sha384_finish().
| #define SHA384_Init pg_SHA384_Init |
Definition at line 45 of file sha2.h.
Referenced by int_sha384_reset().
| #define SHA384_Update pg_SHA384_Update |
Definition at line 46 of file sha2.h.
Referenced by int_sha384_update().
| #define SHA512_BLOCK_LENGTH 128 |
Definition at line 62 of file sha2.h.
Referenced by SHA512_Init(), SHA512_Last(), and SHA512_Update().
| #define SHA512_DIGEST_LENGTH 64 |
Definition at line 63 of file sha2.h.
Referenced by SHA384_Init(), SHA512_Final(), and SHA512_Init().
| #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) |
| #define SHA512_Final pg_SHA512_Final |
Definition at line 50 of file sha2.h.
Referenced by int_sha512_finish().
| #define SHA512_Init pg_SHA512_Init |
Definition at line 48 of file sha2.h.
Referenced by int_sha512_reset().
| #define SHA512_Update pg_SHA512_Update |
Definition at line 49 of file sha2.h.
Referenced by int_sha512_update(), and SHA384_Update().
| typedef SHA256_CTX SHA224_CTX |
| typedef struct _SHA256_CTX SHA256_CTX |
| typedef SHA512_CTX SHA384_CTX |
| typedef struct _SHA512_CTX SHA512_CTX |
| void SHA224_Final | ( | uint8 | [SHA224_DIGEST_LENGTH], | |
| SHA224_CTX * | ||||
| ) |
| void SHA224_Init | ( | SHA224_CTX * | ) |
Definition at line 952 of file sha2.c.
References _SHA256_CTX::bitcount, _SHA256_CTX::buffer, NULL, sha224_initial_hash_value, SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, and _SHA256_CTX::state.
Referenced by int_sha224_reset().
{
if (context == NULL)
return;
memcpy(context->state, sha224_initial_hash_value, SHA256_DIGEST_LENGTH);
memset(context->buffer, 0, SHA256_BLOCK_LENGTH);
context->bitcount = 0;
}
| void SHA224_Update | ( | SHA224_CTX * | , | |
| const uint8 * | , | |||
| size_t | ||||
| ) |
Definition at line 962 of file sha2.c.
References SHA256_Update.
Referenced by int_sha224_update().
{
SHA256_Update((SHA256_CTX *) context, data, len);
}
| void SHA256_Final | ( | uint8 | [SHA256_DIGEST_LENGTH], | |
| SHA256_CTX * | ||||
| ) |
| void SHA256_Init | ( | SHA256_CTX * | ) |
Definition at line 253 of file sha2.c.
References _SHA256_CTX::bitcount, _SHA256_CTX::buffer, NULL, SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, sha256_initial_hash_value, and _SHA256_CTX::state.
{
if (context == NULL)
return;
memcpy(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
memset(context->buffer, 0, SHA256_BLOCK_LENGTH);
context->bitcount = 0;
}
| void SHA256_Update | ( | SHA256_CTX * | , | |
| const uint8 * | , | |||
| size_t | ||||
| ) |
Definition at line 450 of file sha2.c.
References _SHA256_CTX::bitcount, _SHA256_CTX::buffer, SHA256_BLOCK_LENGTH, and SHA256_Transform().
{
size_t freespace,
usedspace;
/* Calling with no data is valid (we do nothing) */
if (len == 0)
return;
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0)
{
/* Calculate how much free space is available in the buffer */
freespace = SHA256_BLOCK_LENGTH - usedspace;
if (len >= freespace)
{
/* Fill the buffer completely and process it */
memcpy(&context->buffer[usedspace], data, freespace);
context->bitcount += freespace << 3;
len -= freespace;
data += freespace;
SHA256_Transform(context, context->buffer);
}
else
{
/* The buffer is not yet full */
memcpy(&context->buffer[usedspace], data, len);
context->bitcount += len << 3;
/* Clean up: */
usedspace = freespace = 0;
return;
}
}
while (len >= SHA256_BLOCK_LENGTH)
{
/* Process as many complete blocks as we can */
SHA256_Transform(context, data);
context->bitcount += SHA256_BLOCK_LENGTH << 3;
len -= SHA256_BLOCK_LENGTH;
data += SHA256_BLOCK_LENGTH;
}
if (len > 0)
{
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
context->bitcount += len << 3;
}
/* Clean up: */
usedspace = freespace = 0;
}
| void SHA384_Final | ( | uint8 | [SHA384_DIGEST_LENGTH], | |
| SHA384_CTX * | ||||
| ) |
| void SHA384_Init | ( | SHA384_CTX * | ) |
Definition at line 908 of file sha2.c.
References _SHA512_CTX::bitcount, _SHA512_CTX::buffer, NULL, SHA384_BLOCK_LENGTH, sha384_initial_hash_value, SHA512_DIGEST_LENGTH, and _SHA512_CTX::state.
{
if (context == NULL)
return;
memcpy(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
memset(context->buffer, 0, SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}
| void SHA384_Update | ( | SHA384_CTX * | , | |
| const uint8 * | , | |||
| size_t | ||||
| ) |
Definition at line 918 of file sha2.c.
References SHA512_Update.
{
SHA512_Update((SHA512_CTX *) context, data, len);
}
| void SHA512_Final | ( | uint8 | [SHA512_DIGEST_LENGTH], | |
| SHA512_CTX * | ||||
| ) |
| void SHA512_Init | ( | SHA512_CTX * | ) |
Definition at line 579 of file sha2.c.
References _SHA512_CTX::bitcount, _SHA512_CTX::buffer, NULL, SHA512_BLOCK_LENGTH, SHA512_DIGEST_LENGTH, sha512_initial_hash_value, and _SHA512_CTX::state.
{
if (context == NULL)
return;
memcpy(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
memset(context->buffer, 0, SHA512_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}
| void SHA512_Update | ( | SHA512_CTX * | , | |
| const uint8 * | , | |||
| size_t | ||||
| ) |
Definition at line 776 of file sha2.c.
References ADDINC128, _SHA512_CTX::bitcount, _SHA512_CTX::buffer, SHA512_BLOCK_LENGTH, and SHA512_Transform().
{
size_t freespace,
usedspace;
/* Calling with no data is valid (we do nothing) */
if (len == 0)
return;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0)
{
/* Calculate how much free space is available in the buffer */
freespace = SHA512_BLOCK_LENGTH - usedspace;
if (len >= freespace)
{
/* Fill the buffer completely and process it */
memcpy(&context->buffer[usedspace], data, freespace);
ADDINC128(context->bitcount, freespace << 3);
len -= freespace;
data += freespace;
SHA512_Transform(context, context->buffer);
}
else
{
/* The buffer is not yet full */
memcpy(&context->buffer[usedspace], data, len);
ADDINC128(context->bitcount, len << 3);
/* Clean up: */
usedspace = freespace = 0;
return;
}
}
while (len >= SHA512_BLOCK_LENGTH)
{
/* Process as many complete blocks as we can */
SHA512_Transform(context, data);
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
len -= SHA512_BLOCK_LENGTH;
data += SHA512_BLOCK_LENGTH;
}
if (len > 0)
{
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
ADDINC128(context->bitcount, len << 3);
}
/* Clean up: */
usedspace = freespace = 0;
}
1.7.1