added hmac functions

This commit is contained in:
2019-08-15 08:25:17 +00:00
parent 4d53acaa94
commit 06712ddd4a
9 changed files with 188 additions and 65 deletions

View File

@ -2,6 +2,7 @@ pkgincludedir = $(includedir)/qse/cry
pkginclude_HEADERS = \
blowfish.h \
hmac.h \
kseed.h \
md5.h \
sha1.h \

View File

@ -341,6 +341,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = \
blowfish.h \
hmac.h \
kseed.h \
md5.h \
sha1.h \

View File

@ -30,13 +30,14 @@
#include <qse/types.h>
#include <qse/macros.h>
#define QSE_MD5_DIGEST_LEN 16
#define QSE_MD5_DIGEST_LEN (16)
#define QSE_MD5_BLOCK_LEN (64)
struct qse_md5_t
{
qse_uint32_t count[2];
qse_uint32_t state[4];
qse_uint8_t buffer[64];
qse_uint8_t buffer[QSE_MD5_BLOCK_LEN];
};
typedef struct qse_md5_t qse_md5_t;

View File

@ -28,16 +28,17 @@
#ifndef _QSE_CRY_SHA1_H_
#define _QSE_CRY_SHA1_H_
#define QSE_SHA1_DIGEST_LEN 20
#include <qse/types.h>
#include <qse/macros.h>
#define QSE_SHA1_DIGEST_LEN (20)
#define QSE_SHA1_BLOCK_LEN (64)
struct qse_sha1_t
{
qse_uint32_t state[5];
qse_uint32_t count[2];
qse_uint8_t buffer[64];
qse_uint8_t buffer[QSE_SHA1_BLOCK_LEN];
};
typedef struct qse_sha1_t qse_sha1_t;

View File

@ -66,22 +66,18 @@
#include <qse/types.h>
#include <qse/macros.h>
/*** SHA-256/384/512 Various Length Definitions ***********************/
#define QSE_SHA256_BLOCK_LEN (64)
#define QSE_SHA256_DIGEST_LEN (32)
#define QSE_SHA384_BLOCK_LEN (128)
#define QSE_SHA384_DIGEST_LEN (48)
#define QSE_SHA512_BLOCK_LEN (128)
#define QSE_SHA512_DIGEST_LEN (64)
/*** SHA-256/384/512 Context Structures *******************************/
#define QSE_SHA256_BLOCK_LEN (64)
#define QSE_SHA256_DIGEST_LEN (32)
#define QSE_SHA384_BLOCK_LEN (128)
#define QSE_SHA384_DIGEST_LEN (48)
#define QSE_SHA512_BLOCK_LEN (128)
#define QSE_SHA512_DIGEST_LEN (64)
struct qse_sha256_t
{
qse_uint32_t state[8];
qse_uint32_t state[8];
qse_uint64_t bitcount;
qse_uint8_t buffer[QSE_SHA256_BLOCK_LEN];
qse_uint8_t buffer[QSE_SHA256_BLOCK_LEN];
};
typedef struct qse_sha256_t qse_sha256_t;