A simple library to support serving https.
Dependents: oldheating gps motorhome heating
sha/sha1.h@7:94ef5824c3c0, 2019-09-05 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Sep 05 12:58:41 2019 +0000
- Revision:
- 7:94ef5824c3c0
- Parent:
- 6:819c17738dc2
- Child:
- 14:03a0b8fd6ddc
Client handshake is now verified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 7:94ef5824c3c0 | 1 | #pragma once |
andrewboyson | 7:94ef5824c3c0 | 2 | |
andrewboyson | 6:819c17738dc2 | 3 | #include <stdint.h> |
andrewboyson | 7:94ef5824c3c0 | 4 | #define SHA1_HASH_SIZE 20 |
andrewboyson | 6:819c17738dc2 | 5 | #define SHA1_BLOCK_SIZE 64 |
andrewboyson | 6:819c17738dc2 | 6 | |
andrewboyson | 7:94ef5824c3c0 | 7 | struct Sha1State |
andrewboyson | 6:819c17738dc2 | 8 | { |
andrewboyson | 6:819c17738dc2 | 9 | uint32_t count; |
andrewboyson | 7:94ef5824c3c0 | 10 | uint32_t state[SHA1_HASH_SIZE / 4]; |
andrewboyson | 6:819c17738dc2 | 11 | union |
andrewboyson | 6:819c17738dc2 | 12 | { |
andrewboyson | 6:819c17738dc2 | 13 | uint8_t b[SHA1_BLOCK_SIZE]; |
andrewboyson | 6:819c17738dc2 | 14 | uint32_t w[SHA1_BLOCK_SIZE / 4]; |
andrewboyson | 6:819c17738dc2 | 15 | } buf; |
andrewboyson | 6:819c17738dc2 | 16 | }; |
andrewboyson | 7:94ef5824c3c0 | 17 | extern void Sha1Start (struct Sha1State *ctx ); |
andrewboyson | 7:94ef5824c3c0 | 18 | extern void Sha1Add (struct Sha1State *ctx, const uint8_t *data, int len ); |
andrewboyson | 7:94ef5824c3c0 | 19 | extern void Sha1Finish(struct Sha1State *ctx, uint8_t *out); |
andrewboyson | 7:94ef5824c3c0 | 20 | extern void Sha1 ( const uint8_t *data, int len, uint8_t *out); |