From 7759dda0c280366ebc5004fb6e304448e3268b1d Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Tue, 7 Feb 2017 18:21:38 +0100 Subject: [PATCH] sha512 test vector --- sha512.c | 4 ++-- sha512.h | 2 +- vectors_sha512 | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sha512.c b/sha512.c index 1f20919..05d0e28 100644 --- a/sha512.c +++ b/sha512.c @@ -116,7 +116,7 @@ void crypto_sha512_update(crypto_sha512_ctx *ctx, const u8 *in, size_t inlen) } } -void crypto_sha512_finish(crypto_sha512_ctx *ctx, u8 out[64]) +void crypto_sha512_final(crypto_sha512_ctx *ctx, u8 out[64]) { incr(ctx->m_size, ctx->m_index * 8); // size is in bits set_input(ctx, 128); // padding @@ -145,5 +145,5 @@ void crypto_sha512(u8 *out, const u8 *m, size_t n) crypto_sha512_ctx ctx; crypto_sha512_init (&ctx); crypto_sha512_update(&ctx, m, n); - crypto_sha512_finish(&ctx, out); + crypto_sha512_final (&ctx, out); } diff --git a/sha512.h b/sha512.h index b88de92..6909c65 100644 --- a/sha512.h +++ b/sha512.h @@ -14,7 +14,7 @@ typedef struct { void crypto_sha512_init (crypto_sha512_ctx *ctx); void crypto_sha512_update(crypto_sha512_ctx *ctx, const uint8_t *in, size_t inlen); -void crypto_sha512_finish(crypto_sha512_ctx *ctx, uint8_t out[64]); +void crypto_sha512_final (crypto_sha512_ctx *ctx, uint8_t out[64]); void crypto_sha512(uint8_t *out,const uint8_t *input, size_t input_size); diff --git a/vectors_sha512 b/vectors_sha512 index bffb060..bab9ae8 100644 --- a/vectors_sha512 +++ b/vectors_sha512 @@ -9,3 +9,6 @@ hash: 204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b msg: 61626364656667686263646566676869636465666768696a6465666768696a6b65666768696a6b6c666768696a6b6c6d6768696a6b6c6d6e68696a6b6c6d6e6f696a6b6c6d6e6f706a6b6c6d6e6f70716b6c6d6e6f7071726c6d6e6f707172736d6e6f70717273746e6f707172737475 hash: 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 + +msg: 6162636465666768414243444546474861626364656667684142434445464748616263646566676841424344454647486162636465666768414243444546474861626364656667684142434445464748616263646566676841424344454647486162636465666768414243444546474861626364656667684142434445464748 +hash: 0d10792e998fcb5ba10fa1e8d416263b4afb8b830d617b240a4b6f547847dbfe232b0e2d1c0cfb242a0a7da528bdeaaafe00ca516407130dac81fbc4c24c5893 -- 2.47.3