summaryrefslogtreecommitdiff
path: root/src/mongo/util/base64.h
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2018-01-28 17:28:22 -0500
committerSara Golemon <sara.golemon@mongodb.com>2018-02-01 19:06:12 -0500
commit48152225232972473a420ac86100b0d870a5b875 (patch)
tree8a1b96f6ef3ff4b03a62cc0683b86f3e8450bb75 /src/mongo/util/base64.h
parent8bd1b06964b7721d194bdf63b8b1c402feb99388 (diff)
downloadmongo-48152225232972473a420ac86100b0d870a5b875.tar.gz
SERVER-33019 Update User object and DocumentParser to handle SCRAM-SHA-256
Diffstat (limited to 'src/mongo/util/base64.h')
-rw-r--r--src/mongo/util/base64.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/util/base64.h b/src/mongo/util/base64.h
index a9f3ea93b57..b7fd8220f0f 100644
--- a/src/mongo/util/base64.h
+++ b/src/mongo/util/base64.h
@@ -46,5 +46,13 @@ std::string decode(const std::string& s);
bool validate(StringData);
+/**
+ * Calculate how large a given input would expand to.
+ * Effectively: ceil(inLen * 4 / 3)
+ */
+constexpr size_t encodedLength(size_t inLen) {
+ return static_cast<size_t>((inLen + 2.5) / 3) * 4;
+}
+
} // namespace base64
} // namespace mongo