diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs
index f9f2d3a8a..b37415e7a 100644
--- a/PKHeX.Core/PKM/PK3.cs
+++ b/PKHeX.Core/PKM/PK3.cs
@@ -201,6 +201,8 @@ public override void RefreshChecksum()
base.RefreshChecksum();
}
+ protected override ushort CalculateChecksum() => PokeCrypto.GetCHK3(Data);
+
public PK4 ConvertToPK4()
{
PK4 pk4 = new PK4 // Convert away!
diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs
index b44e4382f..a4975f0df 100644
--- a/PKHeX.Core/PKM/PKM.cs
+++ b/PKHeX.Core/PKM/PKM.cs
@@ -39,21 +39,7 @@ public abstract class PKM : ITrainerID, ILangNick, IGameValueLimit, INature
protected byte[] GetData(int Offset, int Length) => Data.Slice(Offset, Length);
- protected virtual ushort CalculateChecksum()
- {
- ushort chk = 0;
- switch (Format)
- {
- case 3:
- for (int i = 32; i < SIZE_STORED; i += 2)
- chk += BitConverter.ToUInt16(Data, i);
- return chk;
- default: // 4+
- for (int i = 8; i < SIZE_STORED; i += 2)
- chk += BitConverter.ToUInt16(Data, i);
- return chk;
- }
- }
+ protected virtual ushort CalculateChecksum() => PokeCrypto.GetCHK(Data, SIZE_STORED);
protected abstract byte[] Encrypt();
public abstract int Format { get; }
diff --git a/PKHeX.Core/PKM/Util/PKMConverter.cs b/PKHeX.Core/PKM/Util/PKMConverter.cs
index 9d58b2f67..f44c4153c 100644
--- a/PKHeX.Core/PKM/Util/PKMConverter.cs
+++ b/PKHeX.Core/PKM/Util/PKMConverter.cs
@@ -78,7 +78,7 @@ public static int GetPKMDataFormat(byte[] data)
case PokeCrypto.SIZE_6PARTY: // collision with PGT, same size.
if (BitConverter.ToUInt16(data, 0x4) != 0) // Bad Sanity?
return -1;
- if (BitConverter.ToUInt32(data, 0x06) == PokeCrypto.GetCHK(data))
+ if (BitConverter.ToUInt32(data, 0x06) == PokeCrypto.GetCHK(data, PokeCrypto.SIZE_6STORED))
return 6;
if (BitConverter.ToUInt16(data, 0x58) != 0) // Encrypted?
{
diff --git a/PKHeX.Core/PKM/Util/PokeCrypto.cs b/PKHeX.Core/PKM/Util/PokeCrypto.cs
index e13f9dce5..567de32c0 100644
--- a/PKHeX.Core/PKM/Util/PokeCrypto.cs
+++ b/PKHeX.Core/PKM/Util/PokeCrypto.cs
@@ -313,12 +313,12 @@ public static byte[] EncryptArray3(byte[] pkm)
/// Gets the checksum of a 232 byte array.
///
/// Decrypted Pokémon data.
- public static ushort GetCHK(byte[] data)
+ /// Offset at which the Stored data ends and the Party data starts.
+ public static ushort GetCHK(byte[] data, int partyStart)
{
ushort chk = 0;
- for (int i = 8; i < SIZE_6STORED; i += 2)
+ for (int i = 8; i < partyStart; i += 2)
chk += BitConverter.ToUInt16(data, i);
-
return chk;
}