/// <summary>Decrypts the encrypted gamesave data (the raw data found in the .dat files) and returns the decrypted data.</summary> /// <param name="data">The encrypted gamesave data to decrypt.</param> /// <returns>The decrypted version of the provided gamesave data.</returns> public static string GDGamesaveDecrypt(string data) { string xored = data.XORStringUTF8(11); // Decrypt XOR ^ 11 string replaced = xored.ConvertBase64URLToNormal(); byte[] gzipb64 = GZipCompression.Decompress(Convert.FromBase64String(replaced)); // Decompress return(GeometryDashStringEncoding.GetString(gzipb64)); // Change to string }
/// <summary>Decrypts the encrypted level string and returns its decrypted version.</summary> /// <param name="ls">The encrypted level string to decrypt.</param> /// <returns>The decrypted version of the provided level string.</returns> public static string GDLevelStringDecrypt(string ls) { string replaced = ls.ConvertBase64URLToNormal(); if (!replaced.StartsWith("H4sIAAAAAAAA")) { throw new ArgumentException("The level string is not valid."); } byte[] gzipb64 = Convert.FromBase64String(replaced); gzipb64 = GZipCompression.Decompress(gzipb64); // Decompress return(GeometryDashStringEncoding.GetString(gzipb64)); // Change to string }