diff options
author | Tharre <tharre3@gmail.com> | 2014-08-24 00:24:54 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2014-08-24 00:24:54 +0200 |
commit | 1e951a9f3b3c35cc108d45acd73147a8dda36f6c (patch) | |
tree | e9090b548b478477fe45470f6b2eb6782e4f715b /src/sha1.h | |
parent | 3466aa6c7ca1ed05dc19e5fc92e230ddc1b17df3 (diff) | |
download | redo-1e951a9f3b3c35cc108d45acd73147a8dda36f6c.tar.gz redo-1e951a9f3b3c35cc108d45acd73147a8dda36f6c.tar.xz redo-1e951a9f3b3c35cc108d45acd73147a8dda36f6c.zip |
Replace openssl SHA1 functions with custom version
Diffstat (limited to 'src/sha1.h')
-rw-r--r-- | src/sha1.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sha1.h b/src/sha1.h new file mode 100644 index 0000000..ee59229 --- /dev/null +++ b/src/sha1.h @@ -0,0 +1,25 @@ +/* + * Secure Hash Algorith SHA-1, as published in FIPS PUB 180-2. + * + * This implementation is in the public domain. Copyright abandoned. + * You may do anything you like with it, including evil things. + * + * This is a rewrite from scratch, based on Linus Torvalds' "block-sha1" + * from the git mailing list (August, 2009). Additional optimization + * ideas cribbed from + * - Artur Skawina (x86, particularly P4, and much benchmarking) + * - Nicolas Pitre (ARM) + */ + +#include <stddef.h> /* For size_t */ +#include <stdint.h> /* For uint32_t, uint64_t */ + +typedef struct SHA_context { + uint64_t len; /* May be shrunk to uint32_t */ + uint32_t iv[5]; + unsigned char buf[64]; /* Must be 32-bit aligned */ +} SHA_CTX; + +void SHA1_Init(struct SHA_context *c); +void SHA1_Update(struct SHA_context *c, void const *p, size_t n); +void SHA1_Final(unsigned char hash[20], struct SHA_context *c); |