summaryrefslogtreecommitdiff
path: root/source/core/slang-digest.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-digest.h')
-rw-r--r--source/core/slang-digest.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/core/slang-digest.h b/source/core/slang-digest.h
new file mode 100644
index 000000000..d1bc80b40
--- /dev/null
+++ b/source/core/slang-digest.h
@@ -0,0 +1,31 @@
+#pragma once
+#include "slang-md5.h"
+#include "../../slang.h"
+
+namespace Slang
+{
+ // Wrapper struct that holds objects necessary for hashing.
+ struct DigestBuilder
+ {
+ public:
+ DigestBuilder()
+ {
+ hashGen.init(&context);
+ }
+
+ template <typename T>
+ void addToDigest(T item)
+ {
+ hashGen.update(&context, item);
+ }
+
+ void finalize(slang::Digest* outHash)
+ {
+ hashGen.finalize(&context, outHash);
+ }
+
+ private:
+ MD5HashGen hashGen;
+ MD5Context context;
+ };
+}