use XoredStream instead of CryptoStream with XorTransform.

This commit is contained in:
morkt 2016-12-25 06:47:13 +04:00
parent 544b4cb067
commit a303a66501
4 changed files with 5 additions and 5 deletions

View File

@ -140,7 +140,7 @@ namespace GameRes.Formats.Aoi
var barc = arc as BoxArchive;
if (null == barc)
return input;
return new CryptoStream (input, new XorTransform (barc.Key), CryptoStreamMode.Read);
return new XoredStream (input, barc.Key);
}
}

View File

@ -80,7 +80,7 @@ namespace GameRes.Formats.X
{
byte key = KnownKeys.First().Value;
var input = arc.File.CreateStream (entry.Offset, entry.Size);
return new CryptoStream (input, new XorTransform (key), CryptoStreamMode.Read);
return new XoredStream (input, key);
}
}
}

View File

@ -58,7 +58,7 @@ namespace GameRes.Formats.KScript
y = header.ToInt32 (0x18);
}
using (var input = new StreamRegion (stream.AsStream, data_offset, true))
using (var crypto = new CryptoStream (input, new XorTransform (key), CryptoStreamMode.Read))
using (var crypto = new XoredStream (input, key))
using (var png = new BinaryStream (crypto, stream.Name))
{
var info = Png.ReadMetaData (png);
@ -82,7 +82,7 @@ namespace GameRes.Formats.KScript
{
var meta = (KgpMetaData)info;
using (var input = new StreamRegion (stream.AsStream, meta.DataOffset, true))
using (var crypto = new CryptoStream (input, new XorTransform (meta.Key), CryptoStreamMode.Read))
using (var crypto = new XoredStream (input, meta.Key))
using (var png = new BinaryStream (crypto, stream.Name))
return Png.Read (png, info);
}

View File

@ -70,7 +70,7 @@ namespace GameRes.Formats.Slg
public override Stream OpenEntry (ArcFile arc, Entry entry)
{
var input = arc.File.CreateStream (entry.Offset, entry.Size);
return new CryptoStream (input, new XorTransform (0x90), CryptoStreamMode.Read);
return new XoredStream (input, 0x90);
}
}
}