/* * Copyright (C) 2023 TU Dresden * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup sys_hashes * * @{ * @file * @brief SHA384 hash function implementation * * @author Mikolai Gütschow * * @} */ #include #include "hashes/sha384.h" void sha384_init(sha384_context_t *ctx) { /* Zero bits processed so far */ ctx->count[0] = ctx->count[1] = 0; /* Magic initialization constants */ ctx->state[0] = 0xcbbb9d5dc1059ed8; ctx->state[1] = 0x629a292a367cd507; ctx->state[2] = 0x9159015a3070dd17; ctx->state[3] = 0x152fecd8f70e5939; ctx->state[4] = 0x67332667ffc00b31; ctx->state[5] = 0x8eb44a8768581511; ctx->state[6] = 0xdb0c2e0d64f98fa7; ctx->state[7] = 0x47b5481dbefa4fa4; } void sha384(const void *data, size_t len, void *digest) { sha384_context_t c; assert(digest); sha384_init(&c); sha384_update(&c, data, len); sha384_final(&c, digest); }