summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/HashFunction.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
commit97f5151099967e6c823d640a90d87bca92c44035 (patch)
tree685caa49488599f87d0caa4e972833b2263d8567 /dviware/dvisvgm/src/HashFunction.cpp
parent25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff)
CTAN sync 201910290300
Diffstat (limited to 'dviware/dvisvgm/src/HashFunction.cpp')
-rw-r--r--dviware/dvisvgm/src/HashFunction.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/dviware/dvisvgm/src/HashFunction.cpp b/dviware/dvisvgm/src/HashFunction.cpp
index 7479fca604..517cc8f3cc 100644
--- a/dviware/dvisvgm/src/HashFunction.cpp
+++ b/dviware/dvisvgm/src/HashFunction.cpp
@@ -31,7 +31,12 @@ using namespace std;
/** Returns a vector containing the names of the currently supported hash algorithms. */
vector<string> HashFunction::supportedAlgorithms () {
- return vector<string> {"md5", "xxh32", "xxh64"};
+ return vector<string> {
+ "md5", "xxh32", "xxh64",
+#ifdef ENABLE_XXH128
+ "xxh128"
+#endif
+ };
}
@@ -52,6 +57,10 @@ unique_ptr<HashFunction> HashFunction::create (const string &name) {
return util::make_unique<XXH32HashFunction>();
if (lowerName == "xxh64")
return util::make_unique<XXH64HashFunction>();
+#ifdef ENABLE_XXH128
+ if (lowerName == "xxh128")
+ return util::make_unique<XXH128HashFunction>();
+#endif
return nullptr;
}
@@ -74,6 +83,15 @@ std::unique_ptr<HashFunction> HashFunction::create (const string &name, const ve
}
+void HashFunction::update (istream &is) {
+ char buf[4096];
+ while (is) {
+ is.read(buf, 4096);
+ update(buf, is.gcount());
+ }
+}
+
+
/** Returns the current digest as hexadecimal value. */
string HashFunction::digestString () const {
ostringstream oss;