inline std::string getUrlEncoded(const std::string& mStr) { std::string result; result.reserve(mStr.size()); for(const auto& c : mStr) if(ssvu::isAlphanumeric(c)) result += c; return getControlStripped(result); }
string getValidator(const Path& mPackPath, const string& mLevelId, const string& mLevelRootString, const Path& mStyleRootPath, const Path& mLuaScriptPath) { string luaScriptContents{mLuaScriptPath.getContentsAsStr()}; std::set<string> luaScriptNames; recursiveFillIncludedLuaFileNames(luaScriptNames, mPackPath, luaScriptContents); string toEncrypt; toEncrypt += mLevelId; toEncrypt += getControlStripped(mLevelRootString); toEncrypt += mStyleRootPath.getContentsAsStr(); toEncrypt += luaScriptContents; for(const auto& lsn : luaScriptNames) { Path path{mPackPath + "/Scripts/" + lsn}; toEncrypt += path.getContentsAsStr(); } toEncrypt = getControlStripped(toEncrypt); return getUrlEncoded(mLevelId) + getMD5Hash(HG_ENCRYPT(toEncrypt)); }