File: skein_port.h

package info (click to toggle)
haskell-skein 0.1.0.7-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 708 kB
  • sloc: ansic: 2,591; haskell: 408; makefile: 8
file content (45 lines) | stat: -rw-r--r-- 1,697 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _SKEIN_PORT_H_
#define _SKEIN_PORT_H_
/*******************************************************************
**
** Platform-specific definitions for Skein hash function.
**
** Source code author: Doug Whiting, 2008.
**
** This algorithm and source code is released to the public domain.
**
** Many thanks to Brian Gladman for his portable header files, which
** have been modified slightly here, to handle a few more platforms.
**
** To port Skein to an "unsupported" platform, change the definitions
** in this file appropriately.
** 
********************************************************************/

/* 2011-09-15: Modified to avoid brg_types and include stdint.h */
#include <stdint.h>

typedef unsigned int    uint_t;             /* native unsigned integer */
typedef uint8_t         u08b_t;             /*  8-bit unsigned integer */
typedef uint64_t        u64b_t;             /* 64-bit unsigned integer */

/*
 * Skein is "natively" little-endian (unlike SHA-xxx), for optimal
 * performance on x86 CPUs.  The Skein code requires the following
 * definitions for dealing with endianness:
 *
 *    Skein_Put64_LSB_First
 *    Skein_Get64_LSB_First
 *    Skein_Swap64
 *
 * In the reference code, these functions are implemented in a
 * very portable (and thus slow) fashion, for clarity. See the file
 * "skein_port.h" in the Optimized_Code directory for ways to make
 * these functions fast(er) on x86 platforms.
 */

u64b_t Skein_Swap64(u64b_t w64);
void   Skein_Put64_LSB_First(u08b_t *dst,const u64b_t *src,size_t bCnt);
void   Skein_Get64_LSB_First(u64b_t *dst,const u08b_t *src,size_t wCnt);

#endif   /* ifndef _SKEIN_PORT_H_ */