aboutsummaryrefslogtreecommitdiff
path: root/sha1.h
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-10-01 22:25:26 +1300
committerDavid Phillips <david@sighup.nz>2017-10-01 22:36:35 +1300
commitfc3b3ebffc676e101ca189a9002efb4117913b15 (patch)
tree4adadf970adebd8af660e4518131f2bebbaa838f /sha1.h
parent5e2dcf4aff14e48c8ca49b1ea1bb200abc43fffc (diff)
downloadsand-leek-fc3b3ebffc676e101ca189a9002efb4117913b15.tar.xz
Add NIH SHA1 implementation mockup for porting
Mocked this up in host code to become familiar with the algorithm, and to iron out most bugs before writing/porting to OpenCL. For laughs, I switched sand-leek to use this implementation instead of OpenSSL's. Performance decrease is about 90% with no change in CFLAGS, and about 60% with -O3 instead of -O2. Of course this holds no weight, since the implementation is only meant to be ported to OpenCL and run on graphics cards where SIMD will skyrocket performance.
Diffstat (limited to 'sha1.h')
-rw-r--r--sha1.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sha1.h b/sha1.h
new file mode 100644
index 0000000..37dea22
--- /dev/null
+++ b/sha1.h
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+struct sha_data {
+ uint32_t a;
+ uint32_t b;
+ uint32_t c;
+ uint32_t d;
+ uint32_t e;
+ uint64_t len;
+ size_t data_len;
+ uint8_t data[64];
+};
+void sha_init(struct sha_data*);
+void sha_update(struct sha_data*, void *, size_t);
+void sha_final(unsigned char*, struct sha_data*);
+