dani-bit Posted September 9, 2017 Share Posted September 9, 2017 I'm working in a save editor for gen3 games and i'm having trouble with the pkm checksums. I'm using MILOTIC.bin as example/test, it's saved checksum is 0x3408 and the one i calculate is 0x3A02 This is the function I'm using to calculate the checksum: public function calcDataChecksum():UInt { var sum:UInt = 0x00; for (i in 0...24) { var pos = i * 2; sum += [this.data[pos], this.data[pos+1]].toUInt16(); } // truncate to 16-bit sum = sum & 0xFFFF; return sum; } And this is how i'm unencrypting the data: public function decryptData(key:UInt):Array<UInt> { var newData:Array<UInt> = []; // data offset at 32 var offset = 32; var ar = key.fromUInt32(); for (i in 0...48) { newData.push(this.pkm[offset+i] ^ ar[i%4]); } return newData; } Can someone help me find what i'm doing wrong? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now