X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/07871354bfa8bbbacb6c6a1966f25b596119c146..aa1082f28ddd05f3b946ca1a9c6bfaa17d18aca5:/ghash.h?ds=sidebyside diff --git a/ghash.h b/ghash.h new file mode 100644 index 0000000..9cee338 --- /dev/null +++ b/ghash.h @@ -0,0 +1,78 @@ +/* -*-c-*- + * + * $Id: ghash.h,v 1.1 1999/12/10 23:16:01 mdw Exp $ + * + * Generic hash function interface + * + * (c) 1999 Straylight/Edgeware + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This file is part of Catacomb. + * + * Catacomb is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Catacomb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with Catacomb; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: ghash.h,v $ + * Revision 1.1 1999/12/10 23:16:01 mdw + * Generic interface. + * + */ + +#ifndef CATACOMB_GHASH_H +#define CATACOMB_GHASH_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#include + +/*----- Generic hash function interface -----------------------------------*/ + +typedef struct gchash_base { + const char *name; /* Name of the hash function */ + size_t hashsz; /* Size of output hash */ +} gchash_base; + +typedef struct ghash { + const struct ghash_ops *ops; /* Pointer to hash operations */ +} ghash; + +typedef struct ghash_ops { + const gchash_base *b; /* Pointer to basic information */ + void (*hash)(ghash */*h*/, const void */*p*/, size_t /*sz*/); /* Hash */ + void (*done)(ghash */*h*/, void */*buf*/); /* Write result */ + void (*destroy)(ghash */*h*/); /* Destroy hash block */ +} ghash_ops; + +typedef struct gchash { + gchash_base b; /* Basic bits of information */ + ghash *(*init)(void); /* Create a new hash instance */ +} gchash; + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif