2022-07-27 19:51:53 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* include/crypto/sha1.h
|
|
|
|
* $OpenBSD: sha1.h,v 1.6 2014/11/16 17:39:09 tedu Exp $
|
2022-07-18 15:00:30 +08:00
|
|
|
* SHA-1 in C
|
|
|
|
* By Steve Reid <steve@edmweb.com>
|
|
|
|
* 100% Public Domain
|
2022-07-27 19:51:53 +08:00
|
|
|
****************************************************************************/
|
2022-07-18 15:00:30 +08:00
|
|
|
|
2022-07-27 19:51:53 +08:00
|
|
|
#ifndef __INCLUDE_CRYPTO_SHA1_H
|
|
|
|
#define __INCLUDE_CRYPTO_SHA1_H
|
2022-07-18 15:00:30 +08:00
|
|
|
|
2022-07-28 17:52:21 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2022-07-27 19:51:53 +08:00
|
|
|
#define SHA1_BLOCK_LENGTH 64
|
|
|
|
#define SHA1_DIGEST_LENGTH 20
|
2022-07-18 15:00:30 +08:00
|
|
|
|
2022-07-27 19:51:53 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t state[5];
|
|
|
|
uint64_t count;
|
|
|
|
unsigned char buffer[SHA1_BLOCK_LENGTH];
|
2022-07-18 15:00:30 +08:00
|
|
|
} SHA1_CTX;
|
|
|
|
|
2022-07-27 19:51:53 +08:00
|
|
|
void sha1init(FAR SHA1_CTX * context);
|
|
|
|
void sha1transform(FAR uint32_t *state,
|
|
|
|
FAR const unsigned char *buffer);
|
|
|
|
void sha1update(FAR SHA1_CTX *context,
|
|
|
|
FAR const void *data,
|
|
|
|
unsigned int len);
|
|
|
|
void sha1final(FAR unsigned char *digest,
|
|
|
|
FAR SHA1_CTX *context);
|
|
|
|
|
|
|
|
#endif /* __INCLUDE_CRYPTO_SHA1_H */
|