summaryrefslogtreecommitdiff
path: root/src/base64.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-03 20:32:44 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 20:32:44 +0300
commite2ea71113672de8189d8e0a5b347c8cf08ea2bf6 (patch)
treef5ac19d887cb7a17db1ff40e8334284bb5e96172 /src/base64.cpp
parent74aa598769b7d6b34af8a3c022ff9b3b79a293eb (diff)
downloadminetest-e2ea71113672de8189d8e0a5b347c8cf08ea2bf6.tar.gz
minetest-e2ea71113672de8189d8e0a5b347c8cf08ea2bf6.tar.bz2
minetest-e2ea71113672de8189d8e0a5b347c8cf08ea2bf6.zip
Check password hash validity
Diffstat (limited to 'src/base64.cpp')
-rw-r--r--src/base64.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/base64.cpp b/src/base64.cpp
index 0dfba5013..90d4de203 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -38,6 +38,13 @@ static inline bool is_base64(unsigned char c) {
return (isalnum(c) || (c == '+') || (c == '/'));
}
+bool base64_is_valid(std::string const& s)
+{
+ for(int i=0; i<s.size(); i++)
+ if(!is_base64(s[i])) return false;
+ return true;
+}
+
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
std::string ret;
int i = 0;