summaryrefslogtreecommitdiff
path: root/src/sha1_md.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sha1_md.cc')
-rw-r--r--src/sha1_md.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sha1_md.cc b/src/sha1_md.cc
new file mode 100644
index 0000000..274eb60
--- /dev/null
+++ b/src/sha1_md.cc
@@ -0,0 +1,16 @@
+#include "sha1.hh"
+
+#include <sha1.h>
+
+namespace sha1 {
+
+std::array<uint8_t, 20> hash(std::span<uint8_t const> input) {
+ std::array<uint8_t, 20> ret;
+ SHA1_CTX ctx;
+ SHA1Init(&ctx);
+ SHA1Update(&ctx, input.data(), input.size());
+ SHA1Final(ret.data(), &ctx);
+ return ret;
+}
+
+} // namespace sha1