aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-24 11:52:30 +0200
committerMattias Andrée <maandree@kth.se>2024-08-24 11:52:30 +0200
commitba0bbce290c3742843fb2e8a693d9060e71eeefb (patch)
tree83950d23e99a4ecaac2801ffedf87e52e3d77007 /libhashsum.h
parentAdd libhashsum_hasher.algorithm_string (diff)
downloadlibhashsum-ba0bbce290c3742843fb2e8a693d9060e71eeefb.tar.gz
libhashsum-ba0bbce290c3742843fb2e8a693d9060e71eeefb.tar.bz2
libhashsum-ba0bbce290c3742843fb2e8a693d9060e71eeefb.tar.xz
Add libhashsum_init_hasher_from_string + m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhashsum.h')
-rw-r--r--libhashsum.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libhashsum.h b/libhashsum.h
index 203ec10..0e49083 100644
--- a/libhashsum.h
+++ b/libhashsum.h
@@ -12,9 +12,11 @@
#if defined(__GNUC__)
# define LIBHASHSUM_USERET_ __attribute__((__warn_unused_result__))
# define LIBHASHSUM_1_NONNULL_ __attribute__((__nonnull__(1)))
+# define LIBHASHSUM_NONNULL_ __attribute__((__nonnull__))
#else
# define LIBHASHSUM_USERET_
# define LIBHASHSUM_1_NONNULL_
+# define LIBHASHSUM_NONNULL_
#endif
@@ -402,6 +404,22 @@ LIBHASHSUM_1_NONNULL_
int libhashsum_init_hasher(struct libhashsum_hasher *this, enum libhashsum_algorithm algorithm);
/**
+ * Create an initialised state for a hash algorithm
+ * and return hash functions and details
+ *
+ * @param this The output parameter for the functions, details, and state
+ * @param algorithm The hashing algorithm and parameters
+ * @return 0 on success, -1 on failure
+ *
+ * @throws EINVAL `algorithm` is not recognised or contains an invalid value
+ * @throws ENOSYS Support for `algorithm` was excluded at compile time
+ *
+ * @since 1.0
+ */
+LIBHASHSUM_NONNULL_
+int libhashsum_init_hasher_from_string(struct libhashsum_hasher *this, const char *algorithm);
+
+/**
* Create an initialised state for MD2
* hashing and return hash functions and details
*