diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-26 09:04:11 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-26 09:04:11 +0200 |
commit | 3621a04cf020cba747ba75136aec7a575890cceb (patch) | |
tree | 1cb7e00db51863beb015f349ac8990db9261a873 /src/sha1.h | |
parent | 94ea8d1ac53b3aada2c616f84b8e4686ae51054c (diff) |
Huge overhall; fix code; remove external deps
Diffstat (limited to 'src/sha1.h')
-rw-r--r-- | src/sha1.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sha1.h b/src/sha1.h new file mode 100644 index 0000000..ea08d37 --- /dev/null +++ b/src/sha1.h @@ -0,0 +1,21 @@ +#ifndef TOTP_SHA1_H +#define TOTP_SHA1_H + +#include <stddef.h> +#include <stdint.h> + +#define SHA1DGSTSZ (20) +#define SHA1BLKSZ (64) + +typedef struct { + uint32_t dgst[SHA1DGSTSZ / sizeof(uint32_t)]; + uint64_t msgsz; + uint8_t buf[SHA1BLKSZ]; + size_t bufsz; +} sha1_t; + +void sha1init(sha1_t *); +void sha1hash(sha1_t *, const uint8_t *, size_t); +void sha1end(sha1_t *, uint8_t *); + +#endif /* !TOTP_SHA1_H */ |