blob: b75cdd9a800854e460206e49aaa686f3bb467134 (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include <stdint.h>
#ifdef LIBHASHSUM_INCLUDE_LIBSHA1_STATE
# include <libsha1.h>
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBSHA2_STATE
# include <libsha2.h>
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBKECCAK_STATE
# include <libkeccak.h>
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBBLAKE_STATE
# include <libblake.h>
#endif
/**
* Hash state
*
* For internal use
*/
union libhashsum_state {
struct {
unsigned char x[32];
unsigned char mp[16];
unsigned char mz[16];
unsigned char sum[16];
unsigned t;
} md2; /* size = [82, 88] */
struct {
union {
uint32_t h32[4];
uint8_t sum[16];
} h;
union {
uint32_t m32[16];
uint8_t m8[64];
} m;
uint64_t count;
} md4; /* size = 70 */
struct {
union {
uint32_t h32[4];
uint8_t sum[16];
} h;
uint8_t m[64];
uint32_t w[16];
uint64_t count;
} md5; /* size = 152 */
struct {
union {
uint32_t h32[4];
uint8_t sum[16];
} h;
union {
uint32_t m32[16];
uint8_t m8[64];
} m;
uint64_t count;
} ripemd_128; /* size = 88 */
struct {
union {
uint32_t h32[5];
uint8_t sum[20];
} h;
union {
uint32_t m32[16];
uint8_t m8[64];
} m;
uint32_t w1[5];
uint32_t w2[5];
uint64_t count;
} ripemd_160; /* size = 132 */
struct {
union {
uint32_t h32[8];
uint8_t sum[32];
} h;
union {
uint32_t m32[16];
uint8_t m8[64];
} m;
uint64_t count;
} ripemd_256; /* size = 104 */
struct {
union {
uint32_t h32[10];
uint8_t sum[40];
} h;
union {
uint32_t m32[16];
uint8_t m8[64];
} m;
uint32_t w1[5];
uint32_t w2[5];
uint64_t count;
} ripemd_320; /* size = 152 */
#ifdef LIBHASHSUM_INCLUDE_LIBSHA1_STATE
struct {
struct libsha1_state s;
uint8_t sum[20];
} sha0, sha1; /* size = [432, 440] */
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBSHA2_STATE
struct {
struct libsha2_state s;
uint8_t sum[64];
} sha2; /* size = [1612, 1624] */
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBKECCAK_STATE
struct {
struct libkeccak_state s;
union {
uint8_t buf[512];
uint8_t *dyn;
} sum;
const char *suffix;
size_t squeezes;
char algostr[256];
} keccak; /* size = [1024, 1072] */
#endif
#ifdef LIBHASHSUM_INCLUDE_LIBBLAKE_STATE
struct {
struct libblake_blake224_state s;
uint8_t buf[128];
char algostr[49];
} blake224; /* size = 233 */
struct {
struct libblake_blake256_state s;
uint8_t buf[128];
char algostr[49];
} blake256; /* size = 233 */
struct {
struct libblake_blake384_state s;
uint8_t buf[256];
char algostr[81];
} blake384; /* size = 449 */
struct {
struct libblake_blake512_state s;
uint8_t buf[256];
char algostr[81];
} blake512; /* size = 449 */
#endif
/* libblake: 48(2s), 96(2b), 144(2Xs), 276(2Xb) */
char max_size[1648];
#define libhashsum_init_hasher libhashsum_init_hasher__1648
#define libhashsum_init_hasher_from_string libhashsum_init_hasher_from_string__1648
};
|