/* SHA-256 finalization. Pads the input data, exports the hash value, and clears the context state.  */
void sha256_final(unsigned char digest[32], sha256_context_t *ctx)
/* SHA-256 finalization. Pads the input data, exports the hash value, and clears the context state.  */
void sha256_final(unsigned char digest[32], sha256_context_t *ctx)
{
    sha256_pad(ctx);
    be32enc_vect(digest, ctx->state, 32);
    memset((void *) ctx, 0, sizeof(*ctx));
}