Announcement

Collapse
No announcement yet.

Decrypting CodeBreaker GBA Codes with C#

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Decrypting CodeBreaker GBA Codes with C#

    I am attempting to decrypt/decode CodeBreaker/GameShark SP/Xploder codes for GBA.

    Thanks to endrift, who made mGBA, I have a decryption tool for Action Replay MAX, GameShark Advance and Action Replay codes written in C# already.

    My primary issues are these:
    How can I determine the Encryption Key(s) for CodeBreaker?
    Does the CodeBreaker for GBA use Tiny Encryption Algorithm?
    If the CodeBreaker does not use Tiny Encryption Algorithm, then what method does it use? Can someone post a code snippet of the decryption method?

    Here's the code for GameShark Advance/Action Replay (v1/v2) decryption
    Code:
    UInt32[] GBAGameSharkSeeds = { UInt32.Parse("09F4FBBD", NumberStyles.HexNumber), UInt32.Parse("9681884A", NumberStyles.HexNumber), UInt32.Parse("352027E9", NumberStyles.HexNumber), UInt32.Parse("F3DEE5A7", NumberStyles.HexNumber) };
    //Tiny Encryption Algorithm
    int i;
    for (i = 0; i < 32; ++i)
    {
    	op2 -= ((op1 << 4) + GBAGameSharkSeeds[2]) ^ (op1 + sum) ^ ((op1 >> 5) + GBAGameSharkSeeds[3]);
    	op1 -= ((op2 << 4) + GBAGameSharkSeeds[0]) ^ (op2 + sum) ^ ((op2 >> 5) + GBAGameSharkSeeds[1]);
    	sum -= 0x9E3779B9;
    }
    //op1 has the Address
    //op2 has the Value
    //Sum, is pointless?

  • #2
    Originally posted by hegyak View Post
    How can I determine the Encryption Key(s) for CodeBreaker?
    You need the "Seed" code which is the first line of a 3 lined Master code that starts with 9, that address line is the Encryption Key. Maybe Parasyte or Rimsky82 can chime in on the method used from that address.
    Spoiler Alert! Click to view...

    THE BAD GUY!!!!!!

    Comment


    • #3
      It's been awhile since I've done all of this. I ported the code from the source of something, maybe arcrypt? Anyway I ported it to PHP, and also to C# for GHtool. I had to reverse the codebreaker decryption since it wasn't in the original source.

      I'm pretty sure it's quite complicated with lots of little subroutines that will baffle your mind. There might even be some stellar math involved that only parasyte can understand, I don't remember. Anyways, I'll look for some sauce for you.
      Please put all complaints in writing and submit them here.

      Above link not working? Try here.

      Comment


      • #4
        I just looked at the source of the gba code stuff in ghtool that I haven't touched in a while. It's pretty ugly, as it's a pretty straight port from C++ and could probably use some optimization. Anyway, if you'd like access to the source, I'd be happy to give you read access if you have a bitbucket account. Also, if you'd like to be a contributor and work on it, we can discuss that as well.
        Please put all complaints in writing and submit them here.

        Above link not working? Try here.

        Comment


        • #5
          I would like to see the source code. My butbucket user name is hegyak.

          Comment

          Working...
          X