diff options
author | chai <chaifix@163.com> | 2021-10-29 18:48:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-29 18:48:10 +0800 |
commit | 2381fe08be1a0c99d9541761b85064b8ece3f253 (patch) | |
tree | 5f04464b7c2ebf3d718b61e959d23f903dd4c6b0 /ThirdParty/hash-library/hash.h | |
parent | 796b4b05ec62eb5d58a634854998f485072e8a2b (diff) |
+md5
Diffstat (limited to 'ThirdParty/hash-library/hash.h')
-rw-r--r-- | ThirdParty/hash-library/hash.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ThirdParty/hash-library/hash.h b/ThirdParty/hash-library/hash.h new file mode 100644 index 0000000..6c6f2ea --- /dev/null +++ b/ThirdParty/hash-library/hash.h @@ -0,0 +1,28 @@ +// ////////////////////////////////////////////////////////// +// hash.h +// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved. +// see http://create.stephan-brumme.com/disclaimer.html +// + +#pragma once + +#include <string> + +/// abstract base class +class Hash +{ +public: + /// compute hash of a memory block + virtual std::string operator()(const void* data, size_t numBytes) = 0; + /// compute hash of a string, excluding final zero + virtual std::string operator()(const std::string& text) = 0; + + /// add arbitrary number of bytes + virtual void add(const void* data, size_t numBytes) = 0; + + /// return latest hash as hex characters + virtual std::string getHash() = 0; + + /// restart + virtual void reset() = 0; +}; |