Created
May 12, 2025 03:04
-
-
Save snightshade/94043ee823dc56953095bbd25323f5b2 to your computer and use it in GitHub Desktop.
AceDecryptor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Cryptography; | |
using System.Text; | |
namespace AceDecryptor; | |
class Program | |
{ | |
private const string Pbkdf2Password = "u8DurGE2"; | |
private const string Pbkdf2Salt = "6BBGizHE"; | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("AceDecryptor - 2025 by nightshade"); | |
Console.WriteLine("Decryption tool for Phoenix Wright: Ace Attorney Trilogy encrypted asset files"); | |
if (args.Length == 0) | |
{ | |
Console.WriteLine("Usage: AceDecryptor.exe <input file>"); | |
return; | |
} | |
var filePath = args[0]; | |
if (!File.Exists(filePath)) | |
{ | |
Console.WriteLine("Error: input file does not exist"); | |
return; | |
} | |
var fileBytes = File.ReadAllBytes(filePath); | |
var outputBytes = Decrypt(fileBytes); | |
File.WriteAllBytes(filePath + ".d", outputBytes); | |
Console.WriteLine("Done!"); | |
} | |
private static byte[] Decrypt(byte[] fileBytes) | |
{ | |
var keyBlockSize = 128; | |
#pragma warning disable SYSLIB0022 | |
#pragma warning disable SYSLIB0041 | |
var rijndael = new RijndaelManaged(); | |
rijndael.BlockSize = keyBlockSize; | |
rijndael.KeySize = keyBlockSize; | |
var deriveBytes = new Rfc2898DeriveBytes(Pbkdf2Password, Encoding.UTF8.GetBytes(Pbkdf2Salt)); | |
deriveBytes.IterationCount = 1000; | |
rijndael.Key = deriveBytes.GetBytes(keyBlockSize / 8); | |
rijndael.IV = deriveBytes.GetBytes(keyBlockSize / 8); | |
using var decryptor = rijndael.CreateDecryptor(); | |
var decryptedBytes = decryptor.TransformFinalBlock(fileBytes, 0, fileBytes.Length); | |
#pragma warning restore SYSLIB0041 | |
#pragma warning restore SYSLIB0022 | |
return decryptedBytes; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment