ReadOnlySpan encrypt signature

No functional change, just notes that the input array is not modified
This commit is contained in:
Kurt
2022-06-14 22:25:56 -07:00
parent 15c4e96097
commit 2a83bc5fa2

View File

@@ -158,7 +158,7 @@ public static byte[] DecryptArray8A(Span<byte> ekm)
/// Encrypts a Gen8 pkm byte array.
/// </summary>
/// <param name="pkm">Decrypted Pokémon data.</param>
public static byte[] EncryptArray8(Span<byte> pkm)
public static byte[] EncryptArray8(ReadOnlySpan<byte> pkm)
{
uint pv = ReadUInt32LittleEndian(pkm);
uint sv = pv >> 13 & 31;
@@ -172,7 +172,7 @@ public static byte[] EncryptArray8(Span<byte> pkm)
/// Encrypts a Gen8 pkm byte array.
/// </summary>
/// <param name="pkm">Decrypted Pokémon data.</param>
public static byte[] EncryptArray8A(Span<byte> pkm)
public static byte[] EncryptArray8A(ReadOnlySpan<byte> pkm)
{
uint pv = ReadUInt32LittleEndian(pkm);
uint sv = pv >> 13 & 31;
@@ -201,7 +201,7 @@ public static byte[] DecryptArray6(Span<byte> ekm)
/// Encrypts a 232 byte + party stat byte array.
/// </summary>
/// <param name="pkm">Decrypted Pokémon data.</param>
public static byte[] EncryptArray6(Span<byte> pkm)
public static byte[] EncryptArray6(ReadOnlySpan<byte> pkm)
{
uint pv = ReadUInt32LittleEndian(pkm);
uint sv = pv >> 13 & 31;
@@ -231,7 +231,7 @@ public static byte[] DecryptArray45(Span<byte> ekm)
/// </summary>
/// <param name="pkm">Decrypted Pokémon data.</param>
/// <returns>Encrypted Pokémon data.</returns>
public static byte[] EncryptArray45(Span<byte> pkm)
public static byte[] EncryptArray45(ReadOnlySpan<byte> pkm)
{
uint pv = ReadUInt32LittleEndian(pkm);
uint chk = ReadUInt16LittleEndian(pkm[6..]);
@@ -330,7 +330,7 @@ public static byte[] DecryptArray3(Span<byte> ekm)
/// <param name="data">Un-shuffled data.</param>
/// <param name="sv">Block order shuffle value</param>
/// <returns>Un-shuffled data.</returns>
private static byte[] ShuffleArray3(Span<byte> data, uint sv)
private static byte[] ShuffleArray3(ReadOnlySpan<byte> data, uint sv)
{
byte[] sdata = data.ToArray();
uint index = sv * 4;
@@ -350,7 +350,7 @@ private static byte[] ShuffleArray3(Span<byte> data, uint sv)
/// </summary>
/// <param name="pkm">Decrypted data.</param>
/// <returns>Encrypted data.</returns>
public static byte[] EncryptArray3(Span<byte> pkm)
public static byte[] EncryptArray3(ReadOnlySpan<byte> pkm)
{
Debug.Assert(pkm.Length is SIZE_3PARTY or SIZE_3STORED);