mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(MrgOpener.Decrypt): added array range parameters.
This commit is contained in:
@@ -75,7 +75,7 @@ namespace GameRes.Formats.FC01
|
|||||||
var key = GuessKey (file, index);
|
var key = GuessKey (file, index);
|
||||||
if (null == key)
|
if (null == key)
|
||||||
throw new UnknownEncryptionScheme();
|
throw new UnknownEncryptionScheme();
|
||||||
Decrypt (index, key.Value);
|
Decrypt (index, 0, index.Length, key.Value);
|
||||||
|
|
||||||
int current_offset = 0;
|
int current_offset = 0;
|
||||||
uint next_offset = LittleEndian.ToUInt32 (index, current_offset+0x1C);
|
uint next_offset = LittleEndian.ToUInt32 (index, current_offset+0x1C);
|
||||||
@@ -132,14 +132,13 @@ namespace GameRes.Formats.FC01
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void Decrypt (byte[] data, int key)
|
static public void Decrypt (byte[] data, int index, int length, int key)
|
||||||
{
|
{
|
||||||
int remaining = data.Length;
|
while (length > 0)
|
||||||
for (int i = 0; i < data.Length; ++i)
|
|
||||||
{
|
{
|
||||||
var v = data[i];
|
var v = data[index];
|
||||||
data[i] = (byte)((v << 1 | v >> 7) ^ key);
|
data[index++] = (byte)((v << 1 | v >> 7) ^ key);
|
||||||
key += remaining--;
|
key += length--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user