Jump to content

Hex Editing Save files: Difference in Encrypted and non encrypted box pokemon files.


theSLAYER

Recommended Posts

Hello Everyone.

I'm attempting to learn how to Encrypt .pkm pc files for black 2 saves.

Using http://projectpokemon.org/wiki/Pokemon_NDS_Structure on Visual Studio 2010 (vb.net)

I've managed to learn how to "Shuffle blocks ABCD",

But when it came to:

X[n+1] = (0x41C64E6D * X[n] + 0x6073)

unencryptedByte = Y xor rand()

I can't seem to get it right.

For my file, the checksum is 6F 11 (will is then trancated to 116F)

My bytes doesn't seem to convert correctly.

First Spoiler is my coding (which I may doubt in structure), Second spoiler is original post:

x1 = Val(&H41C64E6D) * Val("&H" & x0) + Val(&H6073)

a1 = Val("&H" & neworder.Substring(16, 2)) Xor Rnd(x1)

TextBox7.Text = a1

Neworder is the neworder after shuffling,

x0 is 116F

I'm wondering if I used Rnd correctly,

Or is the PRNG equation I made structured wrongly.

PLease help :D

No experience is programming.

Interested to learn.

Using Pokemon Black 2 Sav.

I notice that 136 bytes .pkm files in PC are obviously encrypted. (no shit, I know).

Given I have a Oshawott and used Pokegen to change the species to Snivy,

Using Hex editor, I can see there is not much difference. (unencrypted)

But comparing the encrypted version, there is so much difference!

I'm interested to learn the "mathematical way" of encrypting a .pkm file.

Because honestly speaking, I don't know anything of the algo's and stuff.

:D

EDIT:

I did find this: http://projectpokemon.org/wiki/Pokemon_NDS_Structure

But I need help making sense of it :/

I have issues trying to even multiply the hex2dec numbers as when I convert back dec2hex it is too large to show.

Is there any program that can help me make sense of everything?

I've managed to solve most issue, except for the

Y xor rand() .

Using vb.net

EDIT: SOLVED With RubenPikachu's help :D

Edited by theSLAYER
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...