# HG changeset patch # User jbe # Date 1502627481 -7200 # Node ID 5e6dbaa3e21995210d44d6f7fb24992fa8020232 # Parent b36e366bba2bc2e0d50fa0f049d8ade043112c1c Removed endianess specific functions and included header files from moonhash_sha3.c diff -r b36e366bba2b -r 5e6dbaa3e219 libraries/moonhash/moonhash_sha3.c --- a/libraries/moonhash/moonhash_sha3.c Sun Aug 13 03:22:48 2017 +0200 +++ b/libraries/moonhash/moonhash_sha3.c Sun Aug 13 14:31:21 2017 +0200 @@ -1,7 +1,6 @@ /* This file is derived from "Keccak-more-compact.c", which has been downloaded from . The original file "Keccak-more-compact.c" has, according to , been put into the public domain. */ #include -#include #define FOR(i,n) for(i=0; i>1; } #define ROL(a,o) ((((u64)a)<>(64-o))) -#define load64 le64dec -#define store64 le64enc -#if _BYTE_ORDER == _LITTLE_ENDIAN -static void xor64(u8 *x, u64 u) { *(u64 *)x ^= u; } -#else +static u64 load64(const u8 *x) { ui i; u64 u=0; FOR(i,8) { u<<=8; u|=x[7-i]; } return u; } +static void store64(u8 *x, u64 u) { ui i; FOR(i,8) { x[i]=u; u>>=8; } } static void xor64(u8 *x, u64 u) { ui i; FOR(i,8) { x[i]^=u; u>>=8; } } -#endif #define rL(x,y) load64((u8*)s+8*(x+5*y)) #define wL(x,y,l) store64((u8*)s+8*(x+5*y),l) #define XL(x,y,l) xor64((u8*)s+8*(x+5*y),l)