X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/47d5f7c2e72bdc2cc06414e1c07b27760974e2ca..39be270832d86dfa24a84cc0e31fa8f3442f4136:/maurer.h diff --git a/maurer.h b/maurer.h new file mode 100644 index 0000000..cd74e8c --- /dev/null +++ b/maurer.h @@ -0,0 +1,77 @@ +/* -*-c-*- + * + * $Id: maurer.h,v 1.1 2000/06/17 11:29:49 mdw Exp $ + * + * Maurer's universal statistical test + * + * (c) 2000 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: maurer.h,v $ + * Revision 1.1 2000/06/17 11:29:49 mdw + * Maurer's universal statistical test. + * + */ + +#ifndef CATACOMB_MAURER_H +#define CATACOMB_MAURER_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#include + +/*----- Functions provided ------------------------------------------------*/ + +/* --- @maurer@ --- * + * + * Arguments: @const octet *p@ = pointer to a buffer of data + * @size_t sz@ = size of the buffer + * @unsigned l@ = number of bits to take at a time + * + * Returns: The statistic %$Z_u = (X_u - \mu)/\sigma$%, which should be + * normally distributed with a mean of zero and standard + * deviation of 1. + * + * Use: Performs Maurer's universal statistical test on a buffer of + * data. You must ensure that the buffer size @sz@ is larger + * than %$11 l \cdot 2^l$% bits long, and ideally much larger. + * + * Note that, under Unix systems, this function requires the + * maths library. + */ + +extern double maurer(const octet */*p*/, size_t /*sz*/, unsigned /*l*/); + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif