Welcome to little lamb

Code » limb » release » tree

[release] / src / liblimb / hasher_sha512.h / hasher_sha512.c

/* This file is part of limb                           https://lila.oss/limb
 * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <skalibs/sha512.h>
#include <limb/hasher_sha512.h>

static void hsha512_init(void *ctx);
static void hsha512_update(const void *msg, size_t mlen, void *ctx);
static void hsha512_final(void *md, void *ctx);

struct hsha512 {
    hasher h;
    SHA512Schedule ctx;
} hasher_sha512 = {
    .h.hlen = 64,
    .h.blen = 128,
    .h.init = hsha512_init,
    .h.update = hsha512_update,
    .h.final = hsha512_final,
};

static void
hsha512_init(void *ctx)
{
    sha512_init(ctx);
}

static void
hsha512_update(const void *msg, size_t mlen, void *ctx)
{
    sha512_update(ctx, msg, mlen);
}

static void
hsha512_final(void *md, void *ctx)
{
    sha512_final(ctx, md);
}