aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-27 21:02:25 +0200
committerMattias Andrée <maandree@kth.se>2024-08-27 21:02:25 +0200
commit31d9446dc092f1787a19734ae9c30286a9fdba2a (patch)
tree52f32de3f10992a7f7e079f3b0b517272c349151 /libhashsum.h
parentm fix (diff)
downloadlibhashsum-31d9446dc092f1787a19734ae9c30286a9fdba2a.tar.gz
libhashsum-31d9446dc092f1787a19734ae9c30286a9fdba2a.tar.bz2
libhashsum-31d9446dc092f1787a19734ae9c30286a9fdba2a.tar.xz
m misc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libhashsum.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/libhashsum.h b/libhashsum.h
index 7f828c0..29a8f6f 100644
--- a/libhashsum.h
+++ b/libhashsum.h
@@ -61,7 +61,7 @@ enum libhashsum_algorithm {
LIBHASHSUM_SHA3_256, /**< SHA3-256 */
LIBHASHSUM_SHA3_384, /**< SHA3-384 */
LIBHASHSUM_SHA3_512, /**< SHA3-512 */
- LIBHASHSUM_SHAKE128 , /**< SHAKE128 */
+ LIBHASHSUM_SHAKE128, /**< SHAKE128 */
LIBHASHSUM_SHAKE256, /**< SHAKE256 */
LIBHASHSUM_SHAKE512, /**< SHAKE512 */
LIBHASHSUM_RAWSHAKE128, /**< RawSHAKE128 */
@@ -306,6 +306,12 @@ enum libhashsum_algorithm {
#define LIBHASHSUM_BLAKE512_HASH_SIZE 64
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wpadded"
+#endif
+
+
/**
* Hash state
*
@@ -602,6 +608,11 @@ struct libhashsum_hasher {
};
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
+
+
/**
* Create an initialised state for a hash algorithm
* and return hash functions and details
@@ -629,6 +640,20 @@ LIBHASHSUM_1_NONNULL_
int libhashsum_init_hasher(struct libhashsum_hasher *this, enum libhashsum_algorithm algorithm);
/**
+ * Inspect a hashing algorithm string to identify
+ * which algorithm it references
+ *
+ * @param algorithm_out Output parameter for the hashing algorithm
+ * identifier (set if 1 is returned)
+ * @param algorithm The hashing algorithm as a string
+ * @return 1 if the algorithm was recognised, 0 otherwise
+ *
+ * @since 1.0
+ */
+LIBHASHSUM_NONNULL_
+int libhashsum_get_algorithm_string(enum libhashsum_algorithm *algorithm_out, const char *algorithm);
+
+/**
* Create an initialised state for a hash algorithm
* and return hash functions and details
*
@@ -1280,7 +1305,7 @@ int libhashsum_init_blakeb_hasher(struct libhashsum_hasher *this, size_t hashbit
* @param this The output parameter for the functions, details, and state
* @param hashbits Hash output size in bits
* @param salt `NULL` (for all zeroes) or a salt
- * @parma saltbytes The number of bytes in `salt` (ignored if `salt` is `NULL`),
+ * @param saltbytes The number of bytes in `salt` (ignored if `salt` is `NULL`),
* shall be 16 for if `hashbits` is 224 or 256, and 32 if
* `hashbits` is 384 or 512
* @return 0 on success, -1 on failure