aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum.h
diff options
context:
space:
mode:
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