Crypt-Noekeon
view release on metacpan or search on metacpan
/*****************************************************************************
* Nessie.h
*
* Last Modified: 00/08/30 Created: 00/08/30
*
* Project : Nessie Proposal: NOEKEON
*
* Authors : Joan Daemen, Michael Peeters, Vincent Rijmen, Gilles Van Assche
*
* Written by : originally written by [NESSIE]
* modifications brought by Michael Peeters
*
* References : [NESSIE] see http://cryptonessie.org/ for information about
* interface conventions and definition of portable C.
*
* Description: Macro definitions useful for portability
* Data structures used for NOEKEON
*
* Modif. : Minor bugs in U8TO32_BIG & U8TO32_LITTLE,
* data structures for Noekeon
****************************************************************************/
#ifndef PORTABLE_C__
#define PORTABLE_C__
#include <limits.h>
#include <stdio.h>
/* Definition of minimum-width integer types
*
* u8 -> unsigned integer type, at least 8 bits, equivalent to unsigned char
* u16 -> unsigned integer type, at least 16 bits
* u32 -> unsigned integer type, at least 32 bits
*
* s8, s16, s32 -> signed counterparts of u8, u16, u32
*
* Always use macro's T8(), T16() or T32() to obtain exact-width results,
* i.e., to specify the size of the result of each expression.
*/
typedef signed char s8;
typedef unsigned char u8;
#if UINT_MAX >= 4294967295UL
typedef signed short s16;
typedef signed int s32;
typedef unsigned short u16;
typedef unsigned int u32;
#define ONE32 0xffffffffU
#else
typedef signed int s16;
typedef signed long s32;
typedef unsigned int u16;
typedef unsigned long u32;
#define ONE32 0xffffffffUL
#endif
#define ONE8 0xffU
#define ONE16 0xffffU
#define T8(x) ((x) & ONE8)
#define T16(x) ((x) & ONE16)
#define T32(x) ((x) & ONE32)
/*
* If you want 64-bit values, uncomment the following lines; this
* reduces portability.
*/
/*
#if ((1UL << 31) * 2UL) != 0UL
( run in 4.124 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )