+ crypto_hash_sha(256|512)_statebytes

This commit is contained in:
Frank Denis 2015-01-23 11:17:40 +01:00
parent cdbb2dfe75
commit b5deb4d070
5 changed files with 16 additions and 0 deletions

View File

@ -4,3 +4,8 @@ size_t
crypto_hash_sha256_bytes(void) {
return crypto_hash_sha256_BYTES;
}
size_t
crypto_hash_sha256_statebytes(void) {
return sizeof(crypto_hash_sha256_state);
}

View File

@ -4,3 +4,8 @@ size_t
crypto_hash_sha512_bytes(void) {
return crypto_hash_sha512_BYTES;
}
size_t
crypto_hash_sha512_statebytes(void) {
return sizeof(crypto_hash_sha512_state);
}

View File

@ -26,6 +26,8 @@ typedef struct crypto_hash_sha256_state {
uint32_t count[2];
unsigned char buf[64];
} crypto_hash_sha256_state;
SODIUM_EXPORT
size_t crypto_hash_sha256_statebytes(void);
#define crypto_hash_sha256_BYTES 32U
SODIUM_EXPORT

View File

@ -26,6 +26,8 @@ typedef struct crypto_hash_sha512_state {
uint64_t count[2];
unsigned char buf[128];
} crypto_hash_sha512_state;
SODIUM_EXPORT
size_t crypto_hash_sha512_statebytes(void);
#define crypto_hash_sha512_BYTES 64U
SODIUM_EXPORT

View File

@ -36,6 +36,8 @@ int main(void)
assert(crypto_hash_sha256_bytes() > 0U);
assert(crypto_hash_sha512_bytes() >= crypto_hash_sha256_bytes());
assert(crypto_hash_sha512_bytes() == crypto_hash_bytes());
assert(crypto_hash_sha256_statebytes() == sizeof(crypto_hash_sha256_state));
assert(crypto_hash_sha512_statebytes() == sizeof(crypto_hash_sha512_state));
return 0;
}