]> git.lizzy.rs Git - minetest.git/blobdiff - src/base64.cpp
Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2...
[minetest.git] / src / base64.cpp
index 0dfba501303aa4606232c5f667f35f6ea895b86c..90d4de20321c29f87d0f5caa19c8d66822024392 100644 (file)
@@ -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;