mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 12:39:16 +08:00
(MrgOpener.Decrypt): added array range parameters.
This commit is contained in:
parent
203172be77
commit
bcc3583885
@ -75,7 +75,7 @@ namespace GameRes.Formats.FC01
|
||||
var key = GuessKey (file, index);
|
||||
if (null == key)
|
||||
throw new UnknownEncryptionScheme();
|
||||
Decrypt (index, key.Value);
|
||||
Decrypt (index, 0, index.Length, key.Value);
|
||||
|
||||
int current_offset = 0;
|
||||
uint next_offset = LittleEndian.ToUInt32 (index, current_offset+0x1C);
|
||||
@ -132,14 +132,13 @@ namespace GameRes.Formats.FC01
|
||||
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;
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
while (length > 0)
|
||||
{
|
||||
var v = data[i];
|
||||
data[i] = (byte)((v << 1 | v >> 7) ^ key);
|
||||
key += remaining--;
|
||||
var v = data[index];
|
||||
data[index++] = (byte)((v << 1 | v >> 7) ^ key);
|
||||
key += length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user