add sha512-224sum (SHA512/224) and sha512-256sum (SHA512/256)

Signed-off-by: Mattias Andrée <maandree@kth.se>
This commit is contained in:
Mattias Andrée
2016-02-24 11:36:59 +01:00
committed by sin
parent ae1da536bb
commit a392cd475e
10 changed files with 347 additions and 109 deletions

16
sha512-256.h Normal file
View File

@@ -0,0 +1,16 @@
/* public domain sha512/256 implementation based on fips180-3 */
#include "sha512.h"
#define sha512_256 sha512 /*struct*/
enum { SHA512_256_DIGEST_LENGTH = 32 };
/* reset state */
void sha512_256_init(void *ctx);
/* process message */
#define sha512_256_update sha512_update
/* get message digest */
/* state is ruined after sum, keep a copy if multiple sum is needed */
/* part of the message might be left in s, zero it if secrecy is needed */
void sha512_256_sum(void *ctx, uint8_t md[SHA512_256_DIGEST_LENGTH]);