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:
Kaphotics
2016-05-15 15:29:36 -07:00
parent 58babfff71
commit 1036ee3ccb
2 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -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)