Skip to content

Instantly share code, notes, and snippets.

@Aurumaker72
Created March 28, 2024 22:07
Show Gist options
  • Select an option

  • Save Aurumaker72/d8efdbd8af05ab8d01a32c8ef6f90bd5 to your computer and use it in GitHub Desktop.

Select an option

Save Aurumaker72/d8efdbd8af05ab8d01a32c8ef6f90bd5 to your computer and use it in GitHub Desktop.
RPG Maker VX Ace lifted decrypter
var fs = require("fs");
let decryptionAESKey =
"02f3ffa287f78ba68c60f24f79c6fb18ce32b4ebaadac11af5ace8c67a50ae9f";
Decrypter = {};
Decrypter._headerlength = 16;
Decrypter._encryptionKey = "";
Decrypter.SIGNATURE = "5250474d56000000";
Decrypter.VER = "000301";
Decrypter.REMAIN = "0000000000";
Decrypter.decryptArrayBuffer = function (arrayBuffer) {
var header = new Uint8Array(arrayBuffer, 0, this._headerlength);
var i;
var ref = this.SIGNATURE + this.VER + this.REMAIN;
var refBytes = new Uint8Array(16);
for (i = 0; i < this._headerlength; i++) {
refBytes[i] = parseInt("0x" + ref.substr(i * 2, 2), 16);
}
for (i = 0; i < this._headerlength; i++) {
if (header[i] !== refBytes[i]) {
throw new Error("Header is wrong");
}
}
arrayBuffer = this.cutArrayHeader(arrayBuffer, Decrypter._headerlength);
var view = new DataView(arrayBuffer);
this.readEncryptionkey();
if (arrayBuffer) {
var byteArray = new Uint8Array(arrayBuffer);
for (i = 0; i < this._headerlength; i++) {
byteArray[i] = byteArray[i] ^ parseInt(Decrypter._encryptionKey[i], 16);
view.setUint8(i, byteArray[i]);
}
}
return arrayBuffer;
};
Decrypter.readEncryptionkey = function () {
this._encryptionKey = decryptionAESKey.split(/(.{2})/).filter(Boolean);
};
let buf = fs.readFileSync("../img/pictures/ashley_final_warning.k9a").buffer;
Decrypter.decryptArrayBuffer(buf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment