aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-30 17:20:30 +0200
committerMattias Andrée <maandree@kth.se>2024-08-30 17:20:30 +0200
commit87437d71b36518dac5086f8cc92480935e4cf60b (patch)
tree8cabd9b8871320216d371aa7c0e8774fd06d91f4 /libhashsum
parentm + add support for z parameter for keccak (diff)
downloadlibhashsum-87437d71b36518dac5086f8cc92480935e4cf60b.tar.gz
libhashsum-87437d71b36518dac5086f8cc92480935e4cf60b.tar.bz2
libhashsum-87437d71b36518dac5086f8cc92480935e4cf60b.tar.xz
m + add man pages
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhashsum')
-rw-r--r--libhashsum/internal.h165
1 files changed, 165 insertions, 0 deletions
diff --git a/libhashsum/internal.h b/libhashsum/internal.h
new file mode 100644
index 0000000..b75cdd9
--- /dev/null
+++ b/libhashsum/internal.h
@@ -0,0 +1,165 @@
+/* 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
+};