A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

Revision:
7:94ef5824c3c0
Parent:
6:819c17738dc2
Child:
14:03a0b8fd6ddc
--- a/sha/sha1.h	Sun Sep 01 18:15:12 2019 +0000
+++ b/sha/sha1.h	Thu Sep 05 12:58:41 2019 +0000
@@ -1,17 +1,20 @@
+#pragma once
+
 #include <stdint.h>
-#define SHA1_DIGEST_SIZE 20
+#define SHA1_HASH_SIZE 20
 #define SHA1_BLOCK_SIZE 64
 
-struct sha1_ctx
+struct Sha1State
 {
     uint32_t count;
-    uint32_t state[5];
+    uint32_t state[SHA1_HASH_SIZE / 4];
     union
     {
         uint8_t  b[SHA1_BLOCK_SIZE];
         uint32_t w[SHA1_BLOCK_SIZE / 4];
     } buf;
 };
-void sha1_init(struct sha1_ctx *ctx);
-void sha1_update(struct sha1_ctx *ctx, const uint8_t *data, uint32_t len);
-uint8_t *sha1_final(struct sha1_ctx *ctx);
\ No newline at end of file
+extern void Sha1Start (struct Sha1State *ctx                                            );
+extern void Sha1Add   (struct Sha1State *ctx, const uint8_t *data, int len              );
+extern void Sha1Finish(struct Sha1State *ctx,                               uint8_t *out);
+extern void Sha1      (                       const uint8_t *data, int len, uint8_t *out);
\ No newline at end of file