From fc3b3ebffc676e101ca189a9002efb4117913b15 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 1 Oct 2017 22:25:26 +1300 Subject: 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. --- sha1.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sha1.h (limited to 'sha1.h') 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 +#include +#include + +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*); + -- cgit v1.1