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)); }
ByteArray MD5::getHash(const SafeByteArray& data) { return getMD5Hash(data); }