summaryrefslogtreecommitdiff
path: root/src/mongo/crypto
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2017-08-01 11:29:51 -0400
committerJason Carey <jcarey@argv.me>2017-08-17 12:16:40 -0400
commitcb20cab73393fbf725627d5f7b1af5e797866870 (patch)
treed2282b9e7490f7e73ead3cf35a746d0f126b42fd /src/mongo/crypto
parent427647f7cea35a782f3532c02d3e16323c4aea99 (diff)
downloadmongo-cb20cab73393fbf725627d5f7b1af5e797866870.tar.gz
SERVER-28338 KillSessions Support
Diffstat (limited to 'src/mongo/crypto')
-rw-r--r--src/mongo/crypto/sha_block.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/crypto/sha_block.h b/src/mongo/crypto/sha_block.h
index 443ef36ebf4..da61684976e 100644
--- a/src/mongo/crypto/sha_block.h
+++ b/src/mongo/crypto/sha_block.h
@@ -31,6 +31,7 @@
#include <array>
#include <cstddef>
#include <string>
+#include <third_party/murmurhash3/MurmurHash3.h>
#include <vector>
#include "mongo/base/data_range.h"
@@ -192,6 +193,19 @@ public:
return !(*this == other);
}
+ /**
+ * Custom hasher so SHABlocks can be used in unordered data structures.
+ *
+ * ex: std::unordered_set<SHABlock, SHABlock::Hash> shaSet;
+ */
+ struct Hash {
+ std::size_t operator()(const SHABlock& shaBlock) const {
+ uint32_t hash;
+ MurmurHash3_x86_32(shaBlock.data(), SHABlock::kHashLength, 0, &hash);
+ return hash;
+ }
+ };
+
private:
// The backing array of bytes for the sha block
HashType _hash;