aboutsummaryrefslogtreecommitdiffstats
path: root/src/libsha2/digest.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsha2/digest.h')
-rw-r--r--src/libsha2/digest.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/libsha2/digest.h b/src/libsha2/digest.h
new file mode 100644
index 0000000..47b3414
--- /dev/null
+++ b/src/libsha2/digest.h
@@ -0,0 +1,50 @@
+/**
+ * libsha2 – SHA-2-family hashing library
+ *
+ * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef LIBSHA2_DIGEST_H
+#define LIBSHA2_DIGEST_H 1
+
+
+#include "state.h"
+
+
+/**
+ * Absorb more of the message
+ *
+ * @param state The hashing state
+ * @param message The message
+ * @param msglen The length of the message
+ */
+__attribute__((nonnull, nothrow))
+void libsha2_update(libsha2_state_t* restrict state, const char* restrict message, size_t msglen);
+
+/**
+ * Absorb the last part of the message and output a hash
+ *
+ * @param state The hashing state
+ * @param message The message
+ * @param msglen The length of the message, zero if there is nothing more to absorb
+ * @param output The output buffer for the hash
+ */
+__attribute__((nonnull(1, 4), nothrow))
+void libsha2_digest(libsha2_state_t* restrict state, const char* restrict message, size_t msglen, char* output);
+
+
+
+#endif
+