aboutsummaryrefslogtreecommitdiff
path: root/sha256.h
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-07-16 11:47:57 -0400
committerPaul Duncan <pabs@pablotron.org>2019-07-16 11:47:57 -0400
commitb1089d91ec8a7acef32ab588917680e77862617e (patch)
treeca7d6ed5997bb8cd33571cc9b80f10a6a3849874 /sha256.h
downloadsha2-b1089d91ec8a7acef32ab588917680e77862617e.tar.bz2
sha2-b1089d91ec8a7acef32ab588917680e77862617e.zip
initial commit
Diffstat (limited to 'sha256.h')
-rw-r--r--sha256.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/sha256.h b/sha256.h
new file mode 100644
index 0000000..a01e416
--- /dev/null
+++ b/sha256.h
@@ -0,0 +1,24 @@
+#ifndef SHA2_H_
+#define SHA2_H_
+
+#include <stdint.h> // uint32_t, uint8_t
+#include <stdlib.h> // size_t
+
+#define SHA256_HASH_SIZE 32
+
+typedef struct {
+ uint8_t buf[64];
+ size_t buf_len;
+
+ uint32_t h[8];
+ uint32_t w[64];
+
+ uint64_t num_bytes;
+} sha256_t;
+
+void sha256_init(sha256_t * const);
+void sha256_push(sha256_t * const, const uint8_t *, size_t);
+void sha256_fini(sha256_t * const, uint8_t * const);
+void sha256(const uint8_t * const, const size_t, uint8_t * const);
+
+#endif /* SHA2_H_ */