mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
properly dispose of cryptography-related classes.
This commit is contained in:
parent
747f917b44
commit
3e313995d7
@ -125,11 +125,12 @@ namespace GameRes.Formats.Purple
|
|||||||
if (index.Length != index_size)
|
if (index.Length != index_size)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var md5 = MD5.Create();
|
using (var md5 = MD5.Create())
|
||||||
var hash = md5.ComputeHash (index);
|
{
|
||||||
if (!header.Skip (0x10).Take (0x10).SequenceEqual (hash))
|
var hash = md5.ComputeHash (index);
|
||||||
return null;
|
if (!header.Skip (0x10).Take (0x10).SequenceEqual (hash))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
foreach (var scheme in KnownSchemes.Values)
|
foreach (var scheme in KnownSchemes.Values)
|
||||||
{
|
{
|
||||||
// both CmvsMd5 and index will be altered by ReadIndex in decryption attempt
|
// both CmvsMd5 and index will be altered by ReadIndex in decryption attempt
|
||||||
|
@ -89,8 +89,9 @@ namespace GameRes.Formats.NScripter
|
|||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
hmac_key[i] = (byte)(md5_hash[i] ^ sha1_hash[i]);
|
hmac_key[i] = (byte)(md5_hash[i] ^ sha1_hash[i]);
|
||||||
|
|
||||||
var HMAC = new HMACSHA512 (hmac_key);
|
byte[] hmac_hash;
|
||||||
var hmac_hash = HMAC.ComputeHash (m_key);
|
using (var HMAC = new HMACSHA512 (hmac_key))
|
||||||
|
hmac_hash = HMAC.ComputeHash (m_key);
|
||||||
|
|
||||||
int[] map = Enumerable.Range (0, 256).ToArray();
|
int[] map = Enumerable.Range (0, 256).ToArray();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user