mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-15 02:25:26 -05:00
Simplify past gen crypto methods
Seed bypass used by PGT supplied checksum; this is what the fixed methods do already (so remove the parameter).
This commit is contained in:
@@ -38,7 +38,7 @@ public PGT(byte[] data = null)
|
||||
byte[] ekdata = new byte[PK4.SIZE_PARTY];
|
||||
Array.Copy(Data, 8, ekdata, 0, ekdata.Length);
|
||||
// Decrypt PK4
|
||||
PK = new PK4(PKM.decryptArray(ekdata, BitConverter.ToUInt16(ekdata, 6)));
|
||||
PK = new PK4(PKM.decryptArray(ekdata));
|
||||
|
||||
Unknown = new byte[0x10];
|
||||
Array.Copy(Data, 0xF4, Unknown, 0, 0x10);
|
||||
|
||||
@@ -68,7 +68,7 @@ internal static byte[] shuffleArray(byte[] data, uint sv)
|
||||
|
||||
return sdata;
|
||||
}
|
||||
internal static byte[] decryptArray(byte[] ekm, uint seed = 0x10000)
|
||||
internal static byte[] decryptArray(byte[] ekm)
|
||||
{
|
||||
byte[] pkm = (byte[])ekm.Clone();
|
||||
|
||||
@@ -76,7 +76,7 @@ internal static byte[] decryptArray(byte[] ekm, uint seed = 0x10000)
|
||||
uint chk = BitConverter.ToUInt16(pkm, 6);
|
||||
uint sv = ((pv & 0x3E000) >> 0xD) % 24;
|
||||
|
||||
seed = seed > 0xFFFF ? chk : seed;
|
||||
uint seed = chk;
|
||||
|
||||
// Decrypt Blocks with RNG Seed
|
||||
for (int i = 8; i < 136; i += 2)
|
||||
@@ -93,7 +93,7 @@ internal static byte[] decryptArray(byte[] ekm, uint seed = 0x10000)
|
||||
|
||||
return pkm;
|
||||
}
|
||||
internal static byte[] encryptArray(byte[] pkm, uint seed = 0x10000)
|
||||
internal static byte[] encryptArray(byte[] pkm)
|
||||
{
|
||||
uint pv = BitConverter.ToUInt32(pkm, 0);
|
||||
uint sv = ((pv & 0x3E000) >> 0xD) % 24;
|
||||
@@ -103,7 +103,7 @@ internal static byte[] encryptArray(byte[] pkm, uint seed = 0x10000)
|
||||
|
||||
ekm = shuffleArray(ekm, blockPositionInvert[sv]);
|
||||
|
||||
seed = seed > 0xFFFF ? chk : seed;
|
||||
uint seed = chk;
|
||||
|
||||
// Encrypt Blocks with RNG Seed
|
||||
for (int i = 8; i < 136; i += 2)
|
||||
|
||||
Reference in New Issue
Block a user