A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

sha/sha1.h

Committer:
andrewboyson
Date:
2019-09-05
Revision:
7:94ef5824c3c0
Parent:
6:819c17738dc2
Child:
14:03a0b8fd6ddc

File content as of revision 7:94ef5824c3c0:

#pragma once

#include <stdint.h>
#define SHA1_HASH_SIZE 20
#define SHA1_BLOCK_SIZE 64

struct Sha1State
{
    uint32_t count;
    uint32_t state[SHA1_HASH_SIZE / 4];
    union
    {
        uint8_t  b[SHA1_BLOCK_SIZE];
        uint32_t w[SHA1_BLOCK_SIZE / 4];
    } buf;
};
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);