#include <limits.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>Go to the source code of this file.
Classes | |
| struct | NESSIEstruct |
Defines | |
| #define | ONE32 0xffffffffU |
| #define | ONE8 0xffU |
| #define | ONE16 0xffffU |
| #define | T8(x) ((x) & ONE8) |
| #define | T16(x) ((x) & ONE16) |
| #define | T32(x) ((x) & ONE32) |
| #define | LL(v) (v##ULL) |
| #define | ONE64 LL(0xffffffffffffffff) |
| #define | T64(x) ((x) & ONE64) |
| #define | ROTR64(v, n) (((v) >> (n)) | T64((v) << (64 - (n)))) |
| #define | U8TO32_BIG(c) (((u32)T8(*(c)) << 24) | ((u32)T8(*((c) + 1)) << 16) | ((u32)T8(*((c) + 2)) << 8) | ((u32)T8(*((c) + 3)))) |
| #define | U8TO32_LITTLE(c) (((u32)T8(*(c))) | ((u32)T8(*((c) + 1)) << 8) | (u32)T8(*((c) + 2)) << 16) | ((u32)T8(*((c) + 3)) << 24)) |
| #define | U32TO8_BIG(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) |
| #define | U32TO8_LITTLE(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) |
| #define | ROTL32(v, n) (T32((v) << (n)) | ((v) >> (32 - (n)))) |
| #define | DIGESTBYTES 64 |
| #define | DIGESTBITS (8*DIGESTBYTES) |
| #define | WBLOCKBYTES 64 |
| #define | WBLOCKBITS (8*WBLOCKBYTES) |
| #define | LENGTHBYTES 32 |
| #define | LENGTHBITS (8*LENGTHBYTES) |
| #define | R 10 |
Typedefs | |
| typedef signed char | s8 |
| typedef unsigned char | u8 |
| typedef signed short | s16 |
| typedef signed int | s32 |
| typedef unsigned short | u16 |
| typedef unsigned int | u32 |
| typedef unsigned long long | u64 |
| typedef signed long long | s64 |
| typedef struct NESSIEstruct | NESSIEstruct |
Functions | |
| void | NESSIEinit (struct NESSIEstruct *const structpointer) |
| void | NESSIEadd (const unsigned char *const source, unsigned long sourceBits, struct NESSIEstruct *const structpointer) |
| void | NESSIEfinalize (struct NESSIEstruct *const structpointer, unsigned char *const result) |
| #define DIGESTBITS (8*DIGESTBYTES) |
| #define DIGESTBYTES 64 |
| #define LENGTHBITS (8*LENGTHBYTES) |
| #define LENGTHBYTES 32 |
| #define LL | ( | v ) | (v##ULL) |
| #define ONE16 0xffffU |
| #define ONE32 0xffffffffU |
| #define ONE64 LL(0xffffffffffffffff) |
| #define ONE8 0xffU |
| #define R 10 |
| #define ROTL32 | ( | v, | |
| n | |||
| ) | (T32((v) << (n)) | ((v) >> (32 - (n)))) |
| #define ROTR64 | ( | v, | |
| n | |||
| ) | (((v) >> (n)) | T64((v) << (64 - (n)))) |
| #define T16 | ( | x ) | ((x) & ONE16) |
| #define T32 | ( | x ) | ((x) & ONE32) |
| #define T64 | ( | x ) | ((x) & ONE64) |
| #define T8 | ( | x ) | ((x) & ONE8) |
| #define U32TO8_BIG | ( | c, | |
| v | |||
| ) | do { u32 x = (v); u8 *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) |
| #define U32TO8_LITTLE | ( | c, | |
| v | |||
| ) | do { u32 x = (v); u8 *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) |
| #define U8TO32_BIG | ( | c ) | (((u32)T8(*(c)) << 24) | ((u32)T8(*((c) + 1)) << 16) | ((u32)T8(*((c) + 2)) << 8) | ((u32)T8(*((c) + 3)))) |
| #define U8TO32_LITTLE | ( | c ) | (((u32)T8(*(c))) | ((u32)T8(*((c) + 1)) << 8) | (u32)T8(*((c) + 2)) << 16) | ((u32)T8(*((c) + 3)) << 24)) |
| #define WBLOCKBITS (8*WBLOCKBYTES) |
| #define WBLOCKBYTES 64 |
| typedef struct NESSIEstruct NESSIEstruct |
| typedef signed short s16 |
| typedef signed int s32 |
| typedef signed long long s64 |
| typedef signed char s8 |
The Whirlpool hashing function.
References
The Whirlpool algorithm was developed by Paulo S. L. M. Barreto and Vincent Rijmen.
See P.S.L.M. Barreto, V. Rijmen, ``The Whirlpool hashing function,'' NESSIE submission, 2000 (tweaked version, 2001), <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip>
=============================================================================
Differences from version 2.1:
=============================================================================
Differences from version 2.0:
Differences from version 1.0:
=============================================================================
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| typedef unsigned short u16 |
| typedef unsigned int u32 |
| typedef unsigned long long u64 |
| typedef unsigned char u8 |
| void NESSIEadd | ( | const unsigned char *const | source, |
| unsigned long | sourceBits, | ||
| struct NESSIEstruct *const | structpointer | ||
| ) |
Delivers input data to the hashing algorithm.
| source | plaintext data to hash. |
| sourceBits | how many bits of plaintext to process. |
| structpointer | pointer This method maintains the invariant: bufferBits < DIGESTBITS |
| void NESSIEfinalize | ( | struct NESSIEstruct *const | structpointer, |
| unsigned char *const | result | ||
| ) |
Get the hash value from the hashing state.
This method uses the invariant: bufferBits < DIGESTBITS
| void NESSIEinit | ( | struct NESSIEstruct *const | structpointer ) |
Initialize the hashing state.