Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal static string DecryptContent(string content, Encryption enc)
- {
- // removes 'DbdDAwACNS0' from string, converts from base64
- var fixed1 = content.Substring(12).Trim();
- var base64 = Convert.FromBase64String(fixed1);
- enc.encprefix = content.Substring(0, 12);
- // removes unknown bytes, unknown what they mean
- var fixed2 = new byte[base64.Length - 8];
- Buffer.BlockCopy(base64, 8, fixed2, 0, fixed2.Length);
- Buffer.BlockCopy(base64, 0, enc.encBytes, 0, 8);
- // Decrypt with AES using key from above
- var decrypted = AES.Decrypt(fixed2);
- // Decode ASCII 'obfuscation'
- var array = new char[decrypted.Length];
- for (var i = 0; i < decrypted.Length; i++) array[i] = (char)(decrypted[i] + '\u0001');
- var ascii_content = new string(array);
- ascii_content = ascii_content.Replace("\u0001", string.Empty);
- // Continues with Zlib Decompression if needed. DbdDAQEB = Decompression needed
- if (!ascii_content.StartsWith("DbdDAQEB"))
- {
- enc.originalLength = ascii_content.Length;
- enc.enccompressed = false;
- return ascii_content;
- }
- enc.enccompressed = true;
- // removes unnecessary text 'DbdDAQEB', converts from base64
- var fixed3 = ascii_content.Substring(8).Trim();
- var base642 = Convert.FromBase64String(fixed3);
- // removes unknown bytes unknown what they mean
- var fixed4 = new byte[base642.Length - 4];
- Buffer.BlockCopy(base642, 4, fixed4, 0, fixed4.Length);
- Buffer.BlockCopy(base642, 0, enc.encBytes2, 0, 4);
- // Decompress fixed content
- var decompressed = Zlib.Decompress(fixed4);
- var unicode = Encoding.Unicode.GetString(decompressed);
- enc.originalLength = unicode.Length;
- return unicode;
- }
Add Comment
Please, Sign In to add comment