Skip to content

Instantly share code, notes, and snippets.

@Airtnp
Created June 19, 2020 16:44
Show Gist options
  • Save Airtnp/15d2d01d087ca984c835184eda129630 to your computer and use it in GitHub Desktop.
Save Airtnp/15d2d01d087ca984c835184eda129630 to your computer and use it in GitHub Desktop.
Shadowverse card master decryption
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace CardMasterDecompile
{
class Program
{
static void Main(string[] args)
{
// string cardMasterFilePath = args[1];
string cardMasterFilePath = "card_master_1";
Console.WriteLine(File.Exists(cardMasterFilePath));
using (StreamReader reader = new StreamReader(cardMasterFilePath))
{
reader.ReadLine();
string output = DecryptRJ256(reader.ReadToEnd());
File.WriteAllText("card_master.csv", output);
}
}
public static string DecryptRJ256(string prm_text_to_decrypt)
{
string result;
using (AesManaged aesManaged = new AesManaged())
{
string text = prm_text_to_decrypt.Substring(0, 32);
string s = text.Substring(0, 16);
string s2 = prm_text_to_decrypt.Substring(32);
aesManaged.BlockSize = 128;
aesManaged.KeySize = 256;
aesManaged.Key = Encoding.UTF8.GetBytes(text);
aesManaged.IV = Encoding.UTF8.GetBytes(s);
aesManaged.Mode = CipherMode.CBC;
aesManaged.Padding = PaddingMode.PKCS7;
byte[] array = Convert.FromBase64String(s2);
using ICryptoTransform cryptoTransform = aesManaged.CreateDecryptor();
byte[] bytes = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
string @string = Encoding.UTF8.GetString(bytes);
aesManaged.Clear();
result = @string;
}
return result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment