aboutsummaryrefslogtreecommitdiff
path: root/src/sha1.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sha1.h')
-rw-r--r--src/sha1.h21
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 */