summaryrefslogtreecommitdiffstats
path: root/sha512.h
diff options
context:
space:
mode:
Diffstat (limited to 'sha512.h')
-rw-r--r--sha512.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sha512.h b/sha512.h
new file mode 100644
index 0000000..42f822e
--- /dev/null
+++ b/sha512.h
@@ -0,0 +1,20 @@
+#ifndef REPREPRO_SHA512_H
+#define REPREPRO_SHA512_H
+
+/* Structure to save state of computation between the single steps. */
+struct SHA512_Context
+{
+ uint64_t H[8];
+
+ uint64_t total[2];
+ uint64_t buflen;
+ char buffer[256]; /* NB: always correctly aligned for uint32_t. */
+};
+
+#define SHA512_DIGEST_SIZE 64
+
+void SHA512Init(/*@out@*/struct SHA512_Context *context);
+void SHA512Update(struct SHA512_Context *context, const uint8_t *data, size_t len);
+void SHA512Final(struct SHA512_Context *context, /*@out@*/uint8_t digest[SHA512_DIGEST_SIZE]);
+
+#endif