diff options
Diffstat (limited to 'c/sha3.h')
-rw-r--r-- | c/sha3.h | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -19,6 +19,25 @@ #include <stdlib.h> +#ifdef WITH_C99 + #include <inttypes.h> + #define byte int_fast8_t + #define boolean int_fast8_t + #define llong int_fast64_t + #define ullong uint_fast64_t +#else + #define restrict /* introduced in C99 */ + #define byte char + #define boolean char + #if __x86_64__ || __ppc64__ + #define llong long int + #else + #define llong long long int + #endif + #define ullong unsigned llong +#endif + + /** * Initialise Keccak sponge @@ -42,7 +61,7 @@ extern void dispose(void); * @param msg The partial message * @param msglen The length of the partial message */ -extern void update(char* msg, long msglen); +extern void update(byte* restrict msg, long msglen); /** @@ -53,7 +72,7 @@ extern void update(char* msg, long msglen); * @param withReturn Whether to return the hash instead of just do a quick squeeze phrase and return {@code null} * @return The hash sum, or {@code null} if <tt>withReturn</tt> is {@code false} */ -extern char* digest(char* msg, long msglen, long withReturn); +extern byte* digest(byte* restrict msg, long msglen, boolean withReturn); /** @@ -77,5 +96,5 @@ extern void fastSqueeze(long times); * * @return The hash sum */ -extern char* squeeze(void); +extern byte* squeeze(void); |