SpriteHTTPD - embedded HTTP server with read-only filesystem and templating, originally developed for ESP8266, now stand-alone and POSIX compatible.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
spritehttpd/spritehttpd/src/utils/sha1.h

34 lines
730 B

#pragma once
#define HASH_LENGTH 20
#define BLOCK_LENGTH 64
typedef struct httpd_sha1nfo {
uint32_t buffer[BLOCK_LENGTH/4];
uint32_t state[HASH_LENGTH/4];
uint32_t byteCount;
uint8_t bufferOffset;
uint8_t keyBuffer[BLOCK_LENGTH];
uint8_t innerHash[HASH_LENGTH];
} httpd_sha1nfo;
/* public API - prototypes - TODO: doxygen*/
/**
*/
void httpd_sha1_init(httpd_sha1nfo *s);
/**
*/
void httpd_sha1_writebyte(httpd_sha1nfo *s, uint8_t data);
/**
*/
void httpd_sha1_write(httpd_sha1nfo *s, const char *data, size_t len);
/**
*/
uint8_t* httpd_sha1_result(httpd_sha1nfo *s);
/**
*/
void httpd_sha1_initHmac(httpd_sha1nfo *s, const uint8_t* key, size_t keyLength);
/**
*/
uint8_t* httpd_sha1_resultHmac(httpd_sha1nfo *s);