Welcome to little lamb

Code » limb » master » tree

[master] / src / liblimb / hasher_sha1.h / hasher_sha1.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/sha1.h>
#include <limb/hasher_sha1.h>

static void hsha1_init(void *ctx);
static void hsha1_update(const void *msg, size_t mlen, void *ctx);
static void hsha1_final(void *md, void *ctx);

struct hsha1 {
    hasher h;
    SHA1Schedule ctx;
} hasher_sha1 = {
    .h.hlen = 20,
    .h.blen = 64,
    .h.init = hsha1_init,
    .h.update = hsha1_update,
    .h.final = hsha1_final,
};

static void
hsha1_init(void *ctx)
{
    sha1_init(ctx);
}

static void
hsha1_update(const void *msg, size_t mlen, void *ctx)
{
    sha1_update(ctx, msg, mlen);
}

static void
hsha1_final(void *md, void *ctx)
{
    sha1_final(ctx, md);
}