mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-30 17:05:37 +08:00
(McgDecoder): added faulty brute-force key guessing.
disabled in relesase build.
This commit is contained in:
parent
45e7b81cc0
commit
0e57e73ded
@ -192,6 +192,27 @@ namespace GameRes.Formats.FC01
|
|||||||
{
|
{
|
||||||
MrgOpener.Decrypt (m_input, 0, m_input.Length-1, m_key);
|
MrgOpener.Decrypt (m_input, 0, m_input.Length-1, m_key);
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
else // bruteforce key *in debug build only*
|
||||||
|
{
|
||||||
|
for (int key = 1; key < 256; ++key)
|
||||||
|
{
|
||||||
|
var copy = m_input.Clone() as byte[];
|
||||||
|
MrgOpener.Decrypt (copy, 0, copy.Length-1, (byte)key);
|
||||||
|
using (var input = new MemoryStream (copy))
|
||||||
|
using (var lzss = new MrgLzssReader (input, m_input.Length, Stride * m_height))
|
||||||
|
{
|
||||||
|
lzss.Unpack();
|
||||||
|
if (input.Length - input.Position <= 1)
|
||||||
|
{
|
||||||
|
m_output = lzss.Data;
|
||||||
|
m_key = (byte)key;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
using (var input = new MemoryStream (m_input))
|
using (var input = new MemoryStream (m_input))
|
||||||
using (var lzss = new MrgLzssReader (input, m_input.Length, Stride * m_height))
|
using (var lzss = new MrgLzssReader (input, m_input.Length, Stride * m_height))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user