Drag and drop encrypted files to decrypt.
-
-
Save akintos/04e2494c62184d2d4384078b0511673b to your computer and use it in GitHub Desktop.
using System; | |
using System.IO; | |
using System.IO.Compression; | |
static void Main(string[] args) | |
{ | |
byte[] data = File.ReadAllBytes("CARD_Name"); | |
Xor(data); | |
using (MemoryStream ms = new MemoryStream(data)) | |
using (DeflateStream ds = new DeflateStream(ms, CompressionMode.Decompress)) | |
using (FileStream fs = File.Create("CARD_Name.dec")) | |
{ | |
ms.Position = 2; | |
ds.CopyTo(fs); | |
} | |
} | |
static void Xor(byte[] data) | |
{ | |
const byte m_iCryptoKey = 0xB3; | |
for (int i = 0; i < data.Length; i++) | |
{ | |
byte v = (byte)((i + m_iCryptoKey + 0x23D) * m_iCryptoKey); | |
v ^= (byte)(i % 7); | |
data[i] ^= v; | |
} | |
} |
import zlib | |
m_iCryptoKey = 0xB3 | |
with open("CARD_Name", "rb") as f: | |
data = bytearray(f.read()) | |
for i in range(len(data)): | |
v = i + m_iCryptoKey + 0x23D | |
v *= m_iCryptoKey | |
v ^= i % 7 | |
data[i] ^= v & 0xFF | |
with open("CARD_Name.dec", "wb") as f: | |
f.write(zlib.decompress(data)) |
Last masterduel update has changed the crypto key to: "0x131"
Last masterduel update has changed the crypto key to: "0x131"
Thank you for the info!
Do you happen to know the newest crypto key for the November update? Looks like it changed this time as well.
@Ravenite-0
The new crypto key is 0x1A2. Found it with this:
import os
import zlib
m_iCryptoKey = 0x131 ## old crypto key
def Decrypt(file_name):
with open(f'{file_name}', "rb") as f:
data = bytearray(f.read())
for i in range(len(data)):
v = i + m_iCryptoKey + 0x23D
v *= m_iCryptoKey
v ^= i % 7
data[i] ^= v & 0xFF
with open(f'{file_name}' + ".dec", "wb") as f:
f.write(zlib.decompress(data))
while True:
try:
Decrypt('CARD_Indx')
if os.stat('CARD_Indx.dec').st_size > 0:
with open('!CryptoKey.txt', 'w') as f:
f.write(hex(m_iCryptoKey))
print("Crypto key found and written to ""!CryptoKey.txt"" ")
break
except zlib.error:
print("zlib error, CryptoKey =", hex(m_iCryptoKey))
m_iCryptoKey = m_iCryptoKey + 1
print("Press <ENTER> to continue")
input()
New crypto key for Master Duel v1.4.1: 0x23F
That's odd, the crypto key 0x23F works for me for the files CARD_Desc, CARD_Indx and CARD_Name. Which file are you trying to decrypt?
That's odd, the crypto key 0x23F works for me for the files CARD_Desc, CARD_Indx and CARD_Name. Which file are you trying to decrypt?
I've deleted all the files and tried again, and it's working now. Thank you
hello everyone, Can anyone tell me what is CARD_Genre file, i desc but when i use hex to check i can't read the file. Thanks for your reading
p/s also can anyone tell me how can find the rarity card file? Thanks for your reading
The crypto key has changed again with the latest update: 0x25F
Thanks a lot for this! Could you please also code an encryption tool?
Edit: Didn't know it was so easy to code the encryption script:
Edit2: Updated the CryptoKey because it changed with the last Master Duel update and added feature to get input file from parameter.