From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:PK3" |
|---|
| claim | "The 48 data bytes at 0x20 are XORed word by word (u32 LE) with PID ^ OT id (the u32 at offset 4) and the four 12-byte blocks are permuted according to PID % 24; the checksum at 0x1C is the 16-bit sum of the 24 u16 of the decrypted data." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Gen 3 Pokémon entities in saves and .pk3 files" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "reading or writing a PK3" |
|---|
| effect | "decrypt: seed = PID ^ OTID; each u32 of bytes 0x20-0x4F ^= seed; then un-shuffle blocks by PID % 24 (24 orders of G,A,E,M). checksum = sum of u16 LE over decrypted 0x20-0x4F, mod 0x10000" |
|---|
| setting | | name | "checksum offset" |
|---|
| default | "0x1C" |
|---|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Decrypt3, CryptArray3, Shuffle3 and the BlockPosition table" |
|---|
| repo | "https://github.com/kwsch/PKHeX" |
|---|
| commit | "641c26ba100225f3605e5a44b61b3b16e15a3774" |
|---|
| path | "PKHeX.Core/PKM/Util/PokeCrypto.cs" |
|---|
| lines | "62-108,339-346" |
|---|
|
| type | "source" |
|---|
| detail | "CalculateChecksum = Add16 over 0x20..0x50" |
|---|
| repo | "https://github.com/kwsch/PKHeX" |
|---|
| commit | "641c26ba100225f3605e5a44b61b3b16e15a3774" |
|---|
| path | "PKHeX.Core/PKM/PK3.cs" |
|---|
| lines | "204" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "PK3 substructure encryption and checksum" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T18:56:46.312Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:04:32.857Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read Decrypt3/CryptArray3/Shuffle3 and BlockPosition tables in PKHeX PokeCrypto.cs (641c26b): seed = PID ^ u32 at offset 4, sv = PID % 24, u32 XOR over bytes 0x20-0x4F then block unshuffle; PK3.cs CalculateChecksum = Add16 over 0x20..0x50 of the decrypted data." |
|---|
|
|
|---|