mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Move checksum initializers to instance constructors.
This commit is contained in:
@@ -47,7 +47,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the Adler-32 sums
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Adler32Context()
|
||||
{
|
||||
sum1 = 1;
|
||||
sum2 = 0;
|
||||
|
||||
@@ -43,14 +43,14 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
const ushort CRC16_POLY = 0xA001;
|
||||
const ushort CRC16_SEED = 0x0000;
|
||||
ushort hashInt;
|
||||
|
||||
ushort[] table;
|
||||
readonly ushort[] table;
|
||||
ushort hashInt;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CRC16 table and seed
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Crc16Context()
|
||||
{
|
||||
hashInt = CRC16_SEED;
|
||||
|
||||
@@ -59,8 +59,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_POLY);
|
||||
else entry = (ushort)(entry >> 1);
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ CRC16_POLY);
|
||||
else
|
||||
entry = (ushort)(entry >> 1);
|
||||
|
||||
table[i] = entry;
|
||||
}
|
||||
@@ -135,8 +137,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_POLY);
|
||||
else entry = (ushort)(entry >> 1);
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ CRC16_POLY);
|
||||
else
|
||||
entry = (ushort)(entry >> 1);
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
@@ -187,8 +191,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial);
|
||||
else entry = (ushort)(entry >> 1);
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ polynomial);
|
||||
else
|
||||
entry = (ushort)(entry >> 1);
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
@@ -43,14 +43,14 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
const uint CRC32_POLY = 0xEDB88320;
|
||||
const uint CRC32_SEED = 0xFFFFFFFF;
|
||||
uint hashInt;
|
||||
|
||||
uint[] table;
|
||||
readonly uint[] table;
|
||||
uint hashInt;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CRC32 table and seed
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Crc32Context()
|
||||
{
|
||||
hashInt = CRC32_SEED;
|
||||
|
||||
@@ -59,8 +59,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_POLY;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC32_POLY;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
table[i] = entry;
|
||||
}
|
||||
@@ -135,20 +137,22 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_POLY;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC32_POLY;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
for(int i = 0; i < fileStream.Length; i++)
|
||||
{
|
||||
localhashInt = (localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ (localhashInt & 0xff)];
|
||||
if((localhashInt ^ CRC32_SEED) == 0xB883C628 || (localhashInt ^CRC32_SEED) == 0x28C683B8)
|
||||
{
|
||||
localhashInt = (localhashInt >> 8) ^
|
||||
localTable[fileStream.ReadByte() ^ (localhashInt & 0xff)];
|
||||
if((localhashInt ^ CRC32_SEED) == 0xB883C628 ||
|
||||
(localhashInt ^ CRC32_SEED) == 0x28C683B8)
|
||||
System.Console.WriteLine("CRC found at position {0}", fileStream.Position);
|
||||
}
|
||||
}
|
||||
|
||||
localhashInt ^= CRC32_SEED;
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
@@ -193,8 +197,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
@@ -43,14 +43,14 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
const ulong CRC64_POLY = 0xC96C5795D7870F42;
|
||||
const ulong CRC64_SEED = 0xFFFFFFFFFFFFFFFF;
|
||||
ulong hashInt;
|
||||
|
||||
ulong[] table;
|
||||
readonly ulong[] table;
|
||||
ulong hashInt;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CRC64 table and seed
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Crc64Context()
|
||||
{
|
||||
hashInt = CRC64_SEED;
|
||||
|
||||
@@ -59,8 +59,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_POLY;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC64_POLY;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
table[i] = entry;
|
||||
}
|
||||
@@ -135,8 +137,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_POLY;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC64_POLY;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
@@ -187,8 +191,10 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
|
||||
else entry = entry >> 1;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the Fletcher32 sums
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Fletcher32Context()
|
||||
{
|
||||
sum1 = 0xFFFF;
|
||||
sum2 = 0xFFFF;
|
||||
|
||||
@@ -34,11 +34,6 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
public interface IChecksum
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the algorithm
|
||||
/// </summary>
|
||||
void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the hash with data.
|
||||
/// </summary>
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the MD5 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Md5Context()
|
||||
{
|
||||
md5Provider = MD5.Create();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the RIPEMD160 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Ripemd160Context()
|
||||
{
|
||||
ripemd160Provider = RIPEMD160.Create();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the SHA1 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Sha1Context()
|
||||
{
|
||||
sha1Provider = SHA1.Create();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the SHA256 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Sha256Context()
|
||||
{
|
||||
sha256Provider = SHA256.Create();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the SHA384 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Sha384Context()
|
||||
{
|
||||
sha384Provider = SHA384.Create();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <summary>
|
||||
/// Initializes the SHA512 hash provider
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public Sha512Context()
|
||||
{
|
||||
sha512Provider = SHA512.Create();
|
||||
}
|
||||
|
||||
@@ -67,17 +67,13 @@ namespace DiscImageChef.Checksums
|
||||
|
||||
FuzzyState self;
|
||||
|
||||
void roll_init()
|
||||
{
|
||||
self.Roll = new RollState {Window = new byte[ROLLING_WINDOW]};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the SpamSum structures
|
||||
/// </summary>
|
||||
public void Init()
|
||||
public SpamSumContext()
|
||||
{
|
||||
self = new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]};
|
||||
self =
|
||||
new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]};
|
||||
for(int i = 0; i < NUM_BLOCKHASHES; i++) self.Bh[i].Digest = new byte[SPAMSUM_LENGTH];
|
||||
|
||||
self.Bhstart = 0;
|
||||
@@ -91,6 +87,50 @@ namespace DiscImageChef.Checksums
|
||||
roll_init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the hash with data.
|
||||
/// </summary>
|
||||
/// <param name="data">Data buffer.</param>
|
||||
/// <param name="len">Length of buffer to hash.</param>
|
||||
public void Update(byte[] data, uint len)
|
||||
{
|
||||
self.TotalSize += len;
|
||||
for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the hash with data.
|
||||
/// </summary>
|
||||
/// <param name="data">Data buffer.</param>
|
||||
public void Update(byte[] data)
|
||||
{
|
||||
Update(data, (uint)data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a byte array of the hash value.
|
||||
/// </summary>
|
||||
public byte[] Final()
|
||||
{
|
||||
// SpamSum does not have a binary representation, or so it seems
|
||||
throw new NotImplementedException("SpamSum does not have a binary representation.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a base64 representation of the hash value.
|
||||
/// </summary>
|
||||
public string End()
|
||||
{
|
||||
FuzzyDigest(out byte[] result);
|
||||
|
||||
return CToString(result);
|
||||
}
|
||||
|
||||
void roll_init()
|
||||
{
|
||||
self.Roll = new RollState {Window = new byte[ROLLING_WINDOW]};
|
||||
}
|
||||
|
||||
/*
|
||||
* a rolling hash, based on the Adler checksum. By using a rolling hash
|
||||
* we can perform auto resynchronisation after inserts/deletes
|
||||
@@ -165,6 +205,7 @@ namespace DiscImageChef.Checksums
|
||||
* blocksize. */ return;
|
||||
if(self.Bh[self.Bhstart + 1].Dlen < SPAMSUM_LENGTH / 2)
|
||||
/* Estimate adjustment would select this blocksize. */ return;
|
||||
|
||||
/* At this point we are clearly no longer interested in the
|
||||
* start_blocksize. Get rid of it. */
|
||||
++self.Bhstart;
|
||||
@@ -193,6 +234,7 @@ namespace DiscImageChef.Checksums
|
||||
/* Once this condition is false for one bs, it is
|
||||
* automatically false for all further bs. I.e. if
|
||||
* h === -1 (mod 2*bs) then h === -1 (mod bs). */ break;
|
||||
|
||||
/* We have hit a reset point. We now emit hashes which are
|
||||
* based on all characters in the piece of the message between
|
||||
* the last reset point and this one */
|
||||
@@ -218,26 +260,6 @@ namespace DiscImageChef.Checksums
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the hash with data.
|
||||
/// </summary>
|
||||
/// <param name="data">Data buffer.</param>
|
||||
/// <param name="len">Length of buffer to hash.</param>
|
||||
public void Update(byte[] data, uint len)
|
||||
{
|
||||
self.TotalSize += len;
|
||||
for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the hash with data.
|
||||
/// </summary>
|
||||
/// <param name="data">Data buffer.</param>
|
||||
public void Update(byte[] data)
|
||||
{
|
||||
Update(data, (uint)data.Length);
|
||||
}
|
||||
|
||||
// CLAUNIA: Flags seems to never be used in ssdeep, so I just removed it for code simplicity
|
||||
uint FuzzyDigest(out byte[] result)
|
||||
{
|
||||
@@ -259,6 +281,7 @@ namespace DiscImageChef.Checksums
|
||||
++bi;
|
||||
if(bi >= NUM_BLOCKHASHES) throw new OverflowException("The input exceeds data types.");
|
||||
}
|
||||
|
||||
/* Adapt blocksize guess to actual digest length. */
|
||||
while(bi >= self.Bhend) --bi;
|
||||
while(bi > self.Bhstart && self.Bh[bi].Dlen < SPAMSUM_LENGTH / 2) --bi;
|
||||
@@ -288,7 +311,8 @@ namespace DiscImageChef.Checksums
|
||||
if(remain <= 0) throw new Exception("Assertion failed");
|
||||
|
||||
result[resultOff] = b64[self.Bh[bi].H % 64];
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] || result[resultOff] != result[resultOff - 2] ||
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] ||
|
||||
result[resultOff] != result[resultOff - 2] ||
|
||||
result[resultOff] != result[resultOff - 3])
|
||||
{
|
||||
++resultOff;
|
||||
@@ -300,7 +324,8 @@ namespace DiscImageChef.Checksums
|
||||
if(remain <= 0) throw new Exception("Assertion failed");
|
||||
|
||||
result[resultOff] = self.Bh[bi].Digest[i];
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] || result[resultOff] != result[resultOff - 2] ||
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] ||
|
||||
result[resultOff] != result[resultOff - 2] ||
|
||||
result[resultOff] != result[resultOff - 3])
|
||||
{
|
||||
++resultOff;
|
||||
@@ -329,7 +354,8 @@ namespace DiscImageChef.Checksums
|
||||
h = self.Bh[bi].Halfh;
|
||||
result[resultOff] = b64[h % 64];
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] ||
|
||||
result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
|
||||
result[resultOff] != result[resultOff - 2] ||
|
||||
result[resultOff] != result[resultOff - 3])
|
||||
{
|
||||
++resultOff;
|
||||
--remain;
|
||||
@@ -344,7 +370,8 @@ namespace DiscImageChef.Checksums
|
||||
|
||||
result[resultOff] = (byte)i;
|
||||
if(i < 3 || result[resultOff] != result[resultOff - 1] ||
|
||||
result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
|
||||
result[resultOff] != result[resultOff - 2] ||
|
||||
result[resultOff] != result[resultOff - 3])
|
||||
{
|
||||
++resultOff;
|
||||
--remain;
|
||||
@@ -367,25 +394,6 @@ namespace DiscImageChef.Checksums
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a byte array of the hash value.
|
||||
/// </summary>
|
||||
public byte[] Final()
|
||||
{
|
||||
// SpamSum does not have a binary representation, or so it seems
|
||||
throw new NotImplementedException("SpamSum does not have a binary representation.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a base64 representation of the hash value.
|
||||
/// </summary>
|
||||
public string End()
|
||||
{
|
||||
FuzzyDigest(out byte[] result);
|
||||
|
||||
return CToString(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash of a file
|
||||
/// </summary>
|
||||
@@ -417,7 +425,6 @@ namespace DiscImageChef.Checksums
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
SpamSumContext fuzzyContext = new SpamSumContext();
|
||||
fuzzyContext.Init();
|
||||
|
||||
fuzzyContext.Update(data, len);
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using DiscImageChef.Checksums;
|
||||
|
||||
namespace DiscImageChef.Core
|
||||
@@ -140,7 +139,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region Adler32
|
||||
IChecksum ctx = new Adler32Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -173,7 +171,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region CRC16
|
||||
ctx = new Crc16Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -206,7 +203,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region CRC32
|
||||
ctx = new Crc32Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -239,7 +235,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region CRC64
|
||||
ctx = new Crc64Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -272,7 +267,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region MD5
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -305,7 +299,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region RIPEMD160
|
||||
ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -338,7 +331,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region SHA1
|
||||
ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -371,7 +363,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region SHA256
|
||||
ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -404,7 +395,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region SHA384
|
||||
ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -437,7 +427,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region SHA512
|
||||
ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -470,7 +459,6 @@ namespace DiscImageChef.Core
|
||||
|
||||
#region SpamSum
|
||||
ctx = new SpamSumContext();
|
||||
ctx.Init();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
@@ -518,8 +506,6 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
|
||||
EndProgress();
|
||||
double entropy = entTable.Select(l => (double)l / (double)bufferSize)
|
||||
.Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
|
||||
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
|
||||
@@ -102,89 +102,67 @@ namespace DiscImageChef.Core
|
||||
if(enabled.HasFlag(EnableChecksum.Adler32))
|
||||
{
|
||||
adler32Ctx = new Adler32Context();
|
||||
adlerPkt = new HashPacket();
|
||||
adler32Ctx.Init();
|
||||
adlerPkt.Context = adler32Ctx;
|
||||
adlerPkt = new HashPacket {Context = adler32Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Crc16))
|
||||
{
|
||||
crc16Ctx = new Crc16Context();
|
||||
crc16Pkt = new HashPacket();
|
||||
crc16Ctx.Init();
|
||||
crc16Pkt.Context = crc16Ctx;
|
||||
crc16Pkt = new HashPacket {Context = crc16Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Crc32))
|
||||
{
|
||||
crc32Ctx = new Crc32Context();
|
||||
crc32Pkt = new HashPacket();
|
||||
crc32Ctx.Init();
|
||||
crc32Pkt.Context = crc32Ctx;
|
||||
crc32Pkt = new HashPacket {Context = crc32Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Crc64))
|
||||
{
|
||||
crc64Ctx = new Crc64Context();
|
||||
crc64Pkt = new HashPacket();
|
||||
crc64Ctx.Init();
|
||||
crc64Pkt.Context = crc64Ctx;
|
||||
crc64Pkt = new HashPacket {Context = crc64Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Md5))
|
||||
{
|
||||
md5Ctx = new Md5Context();
|
||||
md5Pkt = new HashPacket();
|
||||
md5Ctx.Init();
|
||||
md5Pkt.Context = md5Ctx;
|
||||
md5Pkt = new HashPacket {Context = md5Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Ripemd160))
|
||||
{
|
||||
ripemd160Ctx = new Ripemd160Context();
|
||||
ripemd160Pkt = new HashPacket();
|
||||
ripemd160Ctx.Init();
|
||||
ripemd160Pkt.Context = ripemd160Ctx;
|
||||
ripemd160Pkt = new HashPacket {Context = ripemd160Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Sha1))
|
||||
{
|
||||
sha1Ctx = new Sha1Context();
|
||||
sha1Pkt = new HashPacket();
|
||||
sha1Ctx.Init();
|
||||
sha1Pkt.Context = sha1Ctx;
|
||||
sha1Pkt = new HashPacket {Context = sha1Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Sha256))
|
||||
{
|
||||
sha256Ctx = new Sha256Context();
|
||||
sha256Pkt = new HashPacket();
|
||||
sha256Ctx.Init();
|
||||
sha256Pkt.Context = sha256Ctx;
|
||||
sha256Pkt = new HashPacket {Context = sha256Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Sha384))
|
||||
{
|
||||
sha384Ctx = new Sha384Context();
|
||||
sha384Pkt = new HashPacket();
|
||||
sha384Ctx.Init();
|
||||
sha384Pkt.Context = sha384Ctx;
|
||||
sha384Pkt = new HashPacket {Context = sha384Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Sha512))
|
||||
{
|
||||
sha512Ctx = new Sha512Context();
|
||||
sha512Pkt = new HashPacket();
|
||||
sha512Ctx.Init();
|
||||
sha512Pkt.Context = sha512Ctx;
|
||||
sha512Pkt = new HashPacket {Context = sha512Ctx};
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
ssctx = new SpamSumContext();
|
||||
spamsumPkt = new HashPacket();
|
||||
ssctx.Init();
|
||||
spamsumPkt.Context = ssctx;
|
||||
spamsumPkt = new HashPacket {Context = ssctx};
|
||||
}
|
||||
|
||||
adlerThread = new Thread(UpdateHash);
|
||||
@@ -213,6 +191,7 @@ namespace DiscImageChef.Core
|
||||
crc16Pkt.Data = data;
|
||||
crc16Thread.Start(crc16Pkt);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Crc32))
|
||||
{
|
||||
crc32Pkt.Data = data;
|
||||
@@ -387,110 +366,77 @@ namespace DiscImageChef.Core
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
adler32CtxData = new Adler32Context();
|
||||
HashPacket adlerPktData = new HashPacket();
|
||||
adler32CtxData.Init();
|
||||
adlerPktData.Context = adler32CtxData;
|
||||
adlerPktData.Data = data;
|
||||
HashPacket adlerPktData = new HashPacket {Context = adler32CtxData, Data = data};
|
||||
adlerThreadData.Start(adlerPktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket crc16PktData = new HashPacket();
|
||||
crc16CtxData = new Crc16Context();
|
||||
crc16CtxData.Init();
|
||||
crc16PktData.Context = crc16CtxData;
|
||||
crc16PktData.Data = data;
|
||||
HashPacket crc16PktData = new HashPacket {Context = crc16CtxData, Data = data};
|
||||
crc16ThreadData.Start(crc16PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket crc32PktData = new HashPacket();
|
||||
crc32CtxData = new Crc32Context();
|
||||
crc32CtxData.Init();
|
||||
crc32PktData.Context = crc32CtxData;
|
||||
crc32PktData.Data = data;
|
||||
HashPacket crc32PktData = new HashPacket {Context = crc32CtxData, Data = data};
|
||||
crc32ThreadData.Start(crc32PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket crc64PktData = new HashPacket();
|
||||
crc64CtxData = new Crc64Context();
|
||||
crc64CtxData.Init();
|
||||
crc64PktData.Context = crc64CtxData;
|
||||
crc64PktData.Data = data;
|
||||
HashPacket crc64PktData = new HashPacket {Context = crc64CtxData, Data = data};
|
||||
crc64ThreadData.Start(crc64PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket md5PktData = new HashPacket();
|
||||
md5CtxData = new Md5Context();
|
||||
md5CtxData.Init();
|
||||
md5PktData.Context = md5CtxData;
|
||||
md5PktData.Data = data;
|
||||
HashPacket md5PktData = new HashPacket {Context = md5CtxData, Data = data};
|
||||
md5ThreadData.Start(md5PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket ripemd160PktData = new HashPacket();
|
||||
ripemd160CtxData = new Ripemd160Context();
|
||||
ripemd160CtxData.Init();
|
||||
ripemd160PktData.Context = ripemd160CtxData;
|
||||
ripemd160PktData.Data = data;
|
||||
HashPacket ripemd160PktData = new HashPacket {Context = ripemd160CtxData, Data = data};
|
||||
ripemd160ThreadData.Start(ripemd160PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket sha1PktData = new HashPacket();
|
||||
sha1CtxData = new Sha1Context();
|
||||
sha1CtxData.Init();
|
||||
sha1PktData.Context = sha1CtxData;
|
||||
sha1PktData.Data = data;
|
||||
HashPacket sha1PktData = new HashPacket {Context = sha1CtxData, Data = data};
|
||||
sha1ThreadData.Start(sha1PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket sha256PktData = new HashPacket();
|
||||
sha256CtxData = new Sha256Context();
|
||||
sha256CtxData.Init();
|
||||
sha256PktData.Context = sha256CtxData;
|
||||
sha256PktData.Data = data;
|
||||
HashPacket sha256PktData = new HashPacket {Context = sha256CtxData, Data = data};
|
||||
sha256ThreadData.Start(sha256PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket sha384PktData = new HashPacket();
|
||||
sha384CtxData = new Sha384Context();
|
||||
sha384CtxData.Init();
|
||||
sha384PktData.Context = sha384CtxData;
|
||||
sha384PktData.Data = data;
|
||||
HashPacket sha384PktData = new HashPacket {Context = sha384CtxData, Data = data};
|
||||
sha384ThreadData.Start(sha384PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket sha512PktData = new HashPacket();
|
||||
sha512CtxData = new Sha512Context();
|
||||
sha512CtxData.Init();
|
||||
sha512PktData.Context = sha512CtxData;
|
||||
sha512PktData.Data = data;
|
||||
HashPacket sha512PktData = new HashPacket {Context = sha512CtxData, Data = data};
|
||||
sha512ThreadData.Start(sha512PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
HashPacket spamsumPktData = new HashPacket();
|
||||
ssctxData = new SpamSumContext();
|
||||
ssctxData.Init();
|
||||
spamsumPktData.Context = ssctxData;
|
||||
spamsumPktData.Data = data;
|
||||
HashPacket spamsumPktData = new HashPacket {Context = ssctxData, Data = data};
|
||||
spamsumThreadData.Start(spamsumPktData);
|
||||
}
|
||||
|
||||
|
||||
@@ -1318,7 +1318,6 @@ namespace DiscImageChef.DiscImages
|
||||
if(mapVersion >= 3)
|
||||
{
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
for(uint i = 0; i < totalHunks; i++) sha1Ctx.Update(GetHunk(i));
|
||||
|
||||
calculated = sha1Ctx.Final();
|
||||
@@ -1326,7 +1325,6 @@ namespace DiscImageChef.DiscImages
|
||||
else
|
||||
{
|
||||
Md5Context md5Ctx = new Md5Context();
|
||||
md5Ctx.Init();
|
||||
for(uint i = 0; i < totalHunks; i++) md5Ctx.Update(GetHunk(i));
|
||||
|
||||
calculated = md5Ctx.Final();
|
||||
|
||||
@@ -1770,7 +1770,6 @@ namespace DiscImageChef.DiscImages
|
||||
Marshal.FreeHGlobal(structurePointer);
|
||||
|
||||
crcVerify = new Crc64Context();
|
||||
crcVerify.Init();
|
||||
readBytes = 0;
|
||||
|
||||
DicConsole.DebugWriteLine("DiscImageChef format plugin",
|
||||
@@ -1807,7 +1806,6 @@ namespace DiscImageChef.DiscImages
|
||||
Marshal.FreeHGlobal(structurePointer);
|
||||
|
||||
crcVerify = new Crc64Context();
|
||||
crcVerify.Init();
|
||||
readBytes = 0;
|
||||
|
||||
DicConsole.DebugWriteLine("DiscImageChef format plugin",
|
||||
@@ -2524,29 +2522,13 @@ namespace DiscImageChef.DiscImages
|
||||
imageStream.WriteByte(0);
|
||||
}
|
||||
|
||||
if(doMd5)
|
||||
{
|
||||
md5Provider = new Md5Context();
|
||||
md5Provider.Init();
|
||||
}
|
||||
if(doMd5) md5Provider = new Md5Context();
|
||||
|
||||
if(doSha1)
|
||||
{
|
||||
sha1Provider = new Sha1Context();
|
||||
sha1Provider.Init();
|
||||
}
|
||||
if(doSha1) sha1Provider = new Sha1Context();
|
||||
|
||||
if(doSha256)
|
||||
{
|
||||
sha256Provider = new Sha256Context();
|
||||
sha256Provider.Init();
|
||||
}
|
||||
if(doSha256) sha256Provider = new Sha256Context();
|
||||
|
||||
if(doSpamsum)
|
||||
{
|
||||
spamsumProvider = new SpamSumContext();
|
||||
spamsumProvider.Init();
|
||||
}
|
||||
if(doSpamsum) spamsumProvider = new SpamSumContext();
|
||||
}
|
||||
|
||||
DicConsole.DebugWriteLine("DiscImageChef format plugin", "In memory DDT?: {0}", inMemoryDdt);
|
||||
@@ -2689,7 +2671,6 @@ namespace DiscImageChef.DiscImages
|
||||
currentBlockHeader.crc64 = BitConverter.ToUInt64(crc64.Final(), 0);
|
||||
|
||||
Crc64Context cmpCrc64Context = new Crc64Context();
|
||||
cmpCrc64Context.Init();
|
||||
|
||||
byte[] lzmaProperties = new byte[0];
|
||||
|
||||
@@ -2777,7 +2758,6 @@ namespace DiscImageChef.DiscImages
|
||||
flakeWriter = new FlakeWriter("", blockStream, flakeWriterSettings) {DoSeekTable = false};
|
||||
else lzmaBlockStream = new LzmaStream(lzmaEncoderProperties, false, blockStream);
|
||||
crc64 = new Crc64Context();
|
||||
crc64.Init();
|
||||
}
|
||||
|
||||
ulong ddtEntry = (ulong)((imageStream.Position << shift) + currentBlockOffset);
|
||||
@@ -3111,7 +3091,6 @@ namespace DiscImageChef.DiscImages
|
||||
currentBlockHeader.crc64 = BitConverter.ToUInt64(crc64.Final(), 0);
|
||||
|
||||
Crc64Context cmpCrc64Context = new Crc64Context();
|
||||
cmpCrc64Context.Init();
|
||||
|
||||
byte[] lzmaProperties = new byte[0];
|
||||
|
||||
@@ -3227,7 +3206,6 @@ namespace DiscImageChef.DiscImages
|
||||
{
|
||||
tagData = blockStream.ToArray();
|
||||
Crc64Context crc64Ctx = new Crc64Context();
|
||||
crc64Ctx.Init();
|
||||
crc64Ctx.Update(lzmaProperties);
|
||||
crc64Ctx.Update(tagData);
|
||||
tagCrc = crc64Ctx.Final();
|
||||
@@ -3569,7 +3547,6 @@ namespace DiscImageChef.DiscImages
|
||||
blockStream = new MemoryStream();
|
||||
lzmaBlockStream = new LzmaStream(lzmaEncoderProperties, false, blockStream);
|
||||
crc64 = new Crc64Context();
|
||||
crc64.Init();
|
||||
for(ulong i = 0; i < (ulong)userDataDdt.LongLength; i++)
|
||||
{
|
||||
byte[] ddtEntry = BitConverter.GetBytes(userDataDdt[i]);
|
||||
@@ -3581,7 +3558,6 @@ namespace DiscImageChef.DiscImages
|
||||
lzmaBlockStream.Close();
|
||||
ddtHeader.cmpLength = (uint)blockStream.Length + LZMA_PROPERTIES_LENGTH;
|
||||
Crc64Context cmpCrc64Context = new Crc64Context();
|
||||
cmpCrc64Context.Init();
|
||||
cmpCrc64Context.Update(lzmaProperties);
|
||||
cmpCrc64Context.Update(blockStream.ToArray());
|
||||
ddtHeader.cmpCrc64 = BitConverter.ToUInt64(cmpCrc64Context.Final(), 0);
|
||||
@@ -3665,7 +3641,6 @@ namespace DiscImageChef.DiscImages
|
||||
imageStream.Write(lzmaProperties, 0, lzmaProperties.Length);
|
||||
imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length);
|
||||
|
||||
|
||||
index.RemoveAll(t => t.blockType == BlockType.DataBlock &&
|
||||
t.dataType == DataType.CdSectorPrefix);
|
||||
|
||||
|
||||
@@ -774,9 +774,7 @@ namespace DiscImageChef.DiscImages
|
||||
currentChunk = new BlockChunk();
|
||||
currentSector = 0;
|
||||
dataForkChecksum = new Crc32Context();
|
||||
dataForkChecksum.Init();
|
||||
masterChecksum = new Crc32Context();
|
||||
masterChecksum.Init();
|
||||
|
||||
IsWriting = true;
|
||||
ErrorMessage = null;
|
||||
|
||||
@@ -370,7 +370,6 @@ namespace DiscImageChef.DiscImages
|
||||
thisDateTime = thisDateTime.AddSeconds(thisFooter.Timestamp);
|
||||
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(thisFooter.Reserved);
|
||||
|
||||
DicConsole.DebugWriteLine("VirtualPC plugin", "footer.cookie = 0x{0:X8}", thisFooter.Cookie);
|
||||
@@ -590,7 +589,6 @@ namespace DiscImageChef.DiscImages
|
||||
parentDateTime = parentDateTime.AddSeconds(thisDynamic.ParentTimestamp);
|
||||
|
||||
sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(thisDynamic.Reserved2);
|
||||
|
||||
DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.cookie = 0x{0:X8}", thisDynamic.Cookie);
|
||||
|
||||
@@ -287,7 +287,6 @@ namespace DiscImageChef.Filesystems
|
||||
if(bootBlk.checksum == bsum)
|
||||
{
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(bootBlk.bootCode);
|
||||
sbInformation.AppendLine("Volume is bootable");
|
||||
sbInformation.AppendFormat("Boot code SHA1 is {0}", sha1Ctx.End()).AppendLine();
|
||||
@@ -317,9 +316,11 @@ namespace DiscImageChef.Filesystems
|
||||
sbInformation.AppendFormat("Root block checksum is 0x{0:X8}", rootBlk.checksum).AppendLine();
|
||||
information = sbInformation.ToString();
|
||||
|
||||
XmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks);
|
||||
XmlFsType.CreationDate =
|
||||
DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks);
|
||||
XmlFsType.CreationDateSpecified = true;
|
||||
XmlFsType.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks);
|
||||
XmlFsType.ModificationDate =
|
||||
DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks);
|
||||
XmlFsType.ModificationDateSpecified = true;
|
||||
XmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF;
|
||||
XmlFsType.Clusters = blocks;
|
||||
@@ -390,7 +391,8 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>
|
||||
/// Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] bootCode;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
public byte[] bootCode;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
@@ -424,7 +426,8 @@ namespace DiscImageChef.Filesystems
|
||||
/// Offset 0x18, Hashtable, size = (block size / 4) - 56 or size = hashTableSize.
|
||||
/// Size intentionally bad to allow marshalling to work.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] hashTable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
public uint[] hashTable;
|
||||
/// <summary>
|
||||
/// Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid
|
||||
/// </summary>
|
||||
@@ -432,7 +435,8 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>
|
||||
/// Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public uint[] bitmapPages;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)]
|
||||
public uint[] bitmapPages;
|
||||
/// <summary>
|
||||
/// Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block
|
||||
/// </summary>
|
||||
@@ -452,7 +456,8 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>
|
||||
/// Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public byte[] diskName;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)]
|
||||
public byte[] diskName;
|
||||
/// <summary>
|
||||
/// Offset 0x18+hashTableSize*4+151, unused
|
||||
/// </summary>
|
||||
|
||||
@@ -705,7 +705,6 @@ namespace DiscImageChef.Filesystems
|
||||
string extraInfo = null;
|
||||
string bootChk = null;
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
|
||||
// This is needed because for FAT16, GEMDOS increases bytes per sector count instead of using big_sectors field.
|
||||
uint sectorsPerRealSector;
|
||||
@@ -1527,7 +1526,6 @@ namespace DiscImageChef.Filesystems
|
||||
byte[] bootCode = new byte[512 - sigSize - bpbSector[1] - 2];
|
||||
Array.Copy(bpbSector, bpbSector[1] + 2, bootCode, 0, bootCode.Length);
|
||||
sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(bootCode);
|
||||
bootChk = sha1Ctx.End();
|
||||
}
|
||||
@@ -1539,7 +1537,6 @@ namespace DiscImageChef.Filesystems
|
||||
Array.Copy(bpbSector, BitConverter.ToUInt16(bpbSector, 1) + 3, bootCode, 0,
|
||||
bootCode.Length);
|
||||
sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(bootCode);
|
||||
bootChk = sha1Ctx.End();
|
||||
}
|
||||
|
||||
@@ -52,12 +52,10 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
if(16 + partition.Start >= partition.End) return false;
|
||||
|
||||
uint magic1, magic2;
|
||||
|
||||
byte[] hpfsSbSector =
|
||||
imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16
|
||||
magic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000);
|
||||
magic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004);
|
||||
uint magic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000);
|
||||
uint magic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004);
|
||||
|
||||
return magic1 == 0xF995E849 && magic2 == 0xFA53E9C5;
|
||||
}
|
||||
@@ -94,7 +92,8 @@ namespace DiscImageChef.Filesystems
|
||||
Marshal.FreeHGlobal(spPtr);
|
||||
|
||||
if(StringHandlers.CToString(hpfsBpb.fs_type) != "HPFS " || hpfsSb.magic1 != 0xF995E849 ||
|
||||
hpfsSb.magic2 != 0xFA53E9C5 || hpfsSp.magic1 != 0xF9911849 || hpfsSp.magic2 != 0xFA5229C5)
|
||||
hpfsSb.magic2 != 0xFA53E9C5 || hpfsSp.magic1 != 0xF9911849 ||
|
||||
hpfsSp.magic2 != 0xFA5229C5)
|
||||
{
|
||||
sb.AppendLine("This may not be HPFS, following information may be not correct.");
|
||||
sb.AppendFormat("File system type: \"{0}\" (Should be \"HPFS \")", hpfsBpb.fs_type).AppendLine();
|
||||
@@ -123,18 +122,25 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("NT Flags: 0x{0:X2}", hpfsBpb.nt_flags).AppendLine();
|
||||
sb.AppendFormat("Signature: 0x{0:X2}", hpfsBpb.signature).AppendLine();
|
||||
sb.AppendFormat("Serial number: 0x{0:X8}", hpfsBpb.serial_no).AppendLine();
|
||||
sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, Encoding)).AppendLine();
|
||||
sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, Encoding))
|
||||
.AppendLine();
|
||||
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
|
||||
|
||||
DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk);
|
||||
DateTime lastOptim = DateHandlers.UnixToDateTime(hpfsSb.last_optim);
|
||||
|
||||
sb.AppendFormat("HPFS version: {0}", hpfsSb.version).AppendLine();
|
||||
sb.AppendFormat("Functional version: {0}", hpfsSb.func_version).AppendLine();
|
||||
sb.AppendFormat("Sector of root directory FNode: {0}", hpfsSb.root_fnode).AppendLine();
|
||||
sb.AppendFormat("{0} sectors are marked bad", hpfsSb.badblocks).AppendLine();
|
||||
sb.AppendFormat("Sector of free space bitmaps: {0}", hpfsSb.bitmap_lsn).AppendLine();
|
||||
sb.AppendFormat("Sector of bad blocks list: {0}", hpfsSb.badblock_lsn).AppendLine();
|
||||
sb.AppendFormat("HPFS version: {0}", hpfsSb.version)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Functional version: {0}", hpfsSb.func_version)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Sector of root directory FNode: {0}", hpfsSb.root_fnode)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} sectors are marked bad", hpfsSb.badblocks)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Sector of free space bitmaps: {0}", hpfsSb.bitmap_lsn)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Sector of bad blocks list: {0}", hpfsSb.badblock_lsn)
|
||||
.AppendLine();
|
||||
if(hpfsSb.last_chkdsk > 0) sb.AppendFormat("Date of last integrity check: {0}", lastChk).AppendLine();
|
||||
else sb.AppendLine("Filesystem integrity has never been checked");
|
||||
if(hpfsSb.last_optim > 0) sb.AppendFormat("Date of last optimization {0}", lastOptim).AppendLine();
|
||||
@@ -181,7 +187,6 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
XmlFsType.Bootable = true;
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
string bootChk = sha1Ctx.Data(hpfsBpb.boot_code, out byte[] sha1_out);
|
||||
sb.AppendLine("Volume is bootable");
|
||||
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
|
||||
@@ -205,9 +210,11 @@ namespace DiscImageChef.Filesystems
|
||||
struct HPFS_BIOSParameterBlock
|
||||
{
|
||||
/// <summary>0x000, Jump to boot code</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] jump;
|
||||
/// <summary>0x003, OEM Name, 8 bytes, space-padded</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] oem_name;
|
||||
/// <summary>0x00B, Bytes per sector</summary>
|
||||
public ushort bps;
|
||||
/// <summary>0x00D, Sectors per cluster</summary>
|
||||
@@ -241,11 +248,14 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>0x02B, Volume serial number</summary>
|
||||
public uint serial_no;
|
||||
/// <summary>0x02F, Volume label, 11 bytes, space-padded</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] volume_label;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
public byte[] volume_label;
|
||||
/// <summary>0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ")</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] fs_type;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] fs_type;
|
||||
/// <summary>Boot code.</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] public byte[] boot_code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)]
|
||||
public byte[] boot_code;
|
||||
/// <summary>0x1FE, 0xAA55</summary>
|
||||
public ushort signature2;
|
||||
}
|
||||
|
||||
@@ -569,7 +569,6 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
vdSector = imagePlugin.ReadSector(torito.Value.catalog_sector + partition.Start);
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
|
||||
int toritoOff = 0;
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ namespace DiscImageChef.Filesystems
|
||||
if(2 + partition.Start >= partition.End) return false;
|
||||
|
||||
byte[] eigthBytes = new byte[8];
|
||||
byte fatsNo;
|
||||
ushort spFat, signature;
|
||||
|
||||
byte[] ntfsBpb = imagePlugin.ReadSector(0 + partition.Start);
|
||||
|
||||
@@ -63,16 +61,13 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
if(oemName != "NTFS ") return false;
|
||||
|
||||
fatsNo = ntfsBpb[0x010];
|
||||
byte fatsNo = ntfsBpb[0x010];
|
||||
ushort spFat = BitConverter.ToUInt16(ntfsBpb, 0x016);
|
||||
ushort signature = BitConverter.ToUInt16(ntfsBpb, 0x1FE);
|
||||
|
||||
if(fatsNo != 0) return false;
|
||||
|
||||
spFat = BitConverter.ToUInt16(ntfsBpb, 0x016);
|
||||
|
||||
if(spFat != 0) return false;
|
||||
|
||||
signature = BitConverter.ToUInt16(ntfsBpb, 0x1FE);
|
||||
|
||||
return signature == 0xAA55;
|
||||
}
|
||||
|
||||
@@ -129,7 +124,6 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
XmlFsType.Bootable = true;
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
string bootChk = sha1Ctx.Data(ntfsBb.boot_code, out _);
|
||||
sb.AppendLine("Volume is bootable");
|
||||
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
|
||||
@@ -151,9 +145,11 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
// Start of BIOS Parameter Block
|
||||
/// <summary>0x000, Jump to boot code</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] jump;
|
||||
/// <summary>0x003, OEM Name, 8 bytes, space-padded, must be "NTFS "</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] oem_name;
|
||||
/// <summary>0x00B, Bytes per sector</summary>
|
||||
public ushort bps;
|
||||
/// <summary>0x00D, Sectors per cluster</summary>
|
||||
@@ -210,7 +206,8 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>0x048, Volume serial number</summary>
|
||||
public ulong serial_no;
|
||||
/// <summary>Boot code.</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 430)] public byte[] boot_code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 430)]
|
||||
public byte[] boot_code;
|
||||
/// <summary>0x1FE, 0xAA55</summary>
|
||||
public ushort signature2;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ namespace DiscImageChef.Partitions
|
||||
table.checksum = BigEndianBitConverter.ToUInt16(sector, 510);
|
||||
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(table.boot);
|
||||
DicConsole.DebugWriteLine("Atari partition plugin", "Boot code SHA1: {0}", sha1Ctx.End());
|
||||
|
||||
@@ -244,9 +243,11 @@ namespace DiscImageChef.Partitions
|
||||
uint extendedType = extendedTable.entries[j].type & 0x00FFFFFF;
|
||||
|
||||
if(extendedType != TypeGEMDOS && extendedType != TypeBigGEMDOS &&
|
||||
extendedType != TypeLinux && extendedType != TypeSwap && extendedType != TypeRAW &&
|
||||
extendedType != TypeLinux && extendedType != TypeSwap &&
|
||||
extendedType != TypeRAW &&
|
||||
extendedType != TypeNetBSD && extendedType != TypeNetBSDSwap &&
|
||||
extendedType != TypeSysV && extendedType != TypeMac && extendedType != TypeMinix &&
|
||||
extendedType != TypeSysV && extendedType != TypeMac &&
|
||||
extendedType != TypeMinix &&
|
||||
extendedType != TypeMinix2) continue;
|
||||
|
||||
validTable = true;
|
||||
|
||||
@@ -483,7 +483,8 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
for(ulong i = 0; i < entries; i++)
|
||||
{
|
||||
chainEntry.BlockPairs[i].BadBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0));
|
||||
chainEntry.BlockPairs[i].BadBlock =
|
||||
BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0));
|
||||
chainEntry.BlockPairs[i].GoodBlock =
|
||||
BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4));
|
||||
|
||||
@@ -576,7 +577,8 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved1 = 0x{0:X8}", partEntry.Reserved1);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved2 = 0x{0:X8}", partEntry.Reserved2);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.devFlags = 0x{0:X8}", partEntry.DevFlags);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.driveNameLen = {0}", partEntry.DriveNameLen);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.driveNameLen = {0}",
|
||||
partEntry.DriveNameLen);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.driveName = \"{0}\"", partEntry.DriveName);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved3 = 0x{0:X8}", partEntry.Reserved3);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved4 = 0x{0:X8}", partEntry.Reserved4);
|
||||
@@ -689,7 +691,8 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.flags = 0x{0:X8}", fshd.Flags);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved1 = 0x{0:X8}", fshd.Reserved1);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved2 = 0x{0:X8}", fshd.Reserved2);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dosType = {0}", AmigaDosTypeToString(fshd.DosType));
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dosType = {0}",
|
||||
AmigaDosTypeToString(fshd.DosType));
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.version = {0:D2}.{1:D2} (0x{2:X8})",
|
||||
(fshd.Version & 0xFFFF0000) >> 16, fshd.Version & 0xFFFF, fshd.Version);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.patchFlags = 0x{0:X8}", fshd.PatchFlags);
|
||||
@@ -701,13 +704,13 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.stackSize = {0}", fshd.Dnode.StackSize);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.priority = {0}", fshd.Dnode.Priority);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.startup = {0}", fshd.Dnode.Startup);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.seglist_ptr = {0}", fshd.Dnode.SeglistPtr);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.seglist_ptr = {0}",
|
||||
fshd.Dnode.SeglistPtr);
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.global_vec = 0x{0:X8}", fshd.Dnode.GlobalVec);
|
||||
|
||||
nextBlock = fshd.Dnode.SeglistPtr;
|
||||
bool thereAreLoadSegments = false;
|
||||
Sha1Context sha1Ctx = new Sha1Context();
|
||||
sha1Ctx.Init();
|
||||
while(nextBlock != 0xFFFFFFFF)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block",
|
||||
@@ -770,10 +773,12 @@ namespace DiscImageChef.Partitions
|
||||
Type = AmigaDosTypeToString(rdbEntry.DosEnvVec.DosType),
|
||||
Scheme = Name,
|
||||
Offset =
|
||||
(rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
(rdbEntry.DosEnvVec.LowCylinder *
|
||||
rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
sectorOffset) * rdb.BlockSize,
|
||||
Size = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) *
|
||||
rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt * rdb.BlockSize
|
||||
rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt *
|
||||
rdb.BlockSize
|
||||
}))
|
||||
{
|
||||
partitions.Add(entry);
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Adler32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -104,7 +103,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Adler32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc16Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -104,7 +103,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc16Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -104,7 +103,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc64Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -104,7 +103,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc64Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Md5EmptyFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -59,7 +58,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -74,7 +72,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -84,7 +81,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Md5RandomFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -99,7 +95,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -114,7 +109,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Ripemd160EmptyFile()
|
||||
{
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -65,7 +64,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -80,7 +78,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -90,7 +87,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Ripemd160RandomFile()
|
||||
{
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -105,7 +101,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -120,7 +115,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha1EmptyFile()
|
||||
{
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -65,7 +64,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -80,7 +78,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -90,7 +87,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha1RandomFile()
|
||||
{
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -105,7 +101,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -120,7 +115,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha256EmptyFile()
|
||||
{
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -65,7 +64,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -80,7 +78,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -90,7 +87,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha256RandomFile()
|
||||
{
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -105,7 +101,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -120,7 +115,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha384EmptyFile()
|
||||
{
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -67,7 +66,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -82,7 +80,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -92,7 +89,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha384RandomFile()
|
||||
{
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -107,7 +103,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -122,7 +117,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha512EmptyFile()
|
||||
{
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -69,7 +68,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -84,7 +82,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -94,7 +91,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
public void Sha512RandomFile()
|
||||
{
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -109,7 +105,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -124,7 +119,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new SpamSumContext();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
string result = ctx.End();
|
||||
Assert.AreEqual(EXPECTED_EMPTY, result);
|
||||
@@ -90,7 +89,6 @@ namespace DiscImageChef.Tests.Checksums
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new SpamSumContext();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
string result = ctx.End();
|
||||
Assert.AreEqual(EXPECTED_RANDOM, result);
|
||||
|
||||
@@ -54,12 +54,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -97,7 +95,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -114,7 +111,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -96,7 +94,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -113,7 +110,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -54,12 +54,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -97,7 +95,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -114,7 +111,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -96,7 +94,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -113,7 +110,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -96,7 +94,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -113,7 +110,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -96,7 +94,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -113,7 +110,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,10 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -96,7 +94,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -113,7 +110,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
@@ -88,7 +87,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -105,7 +103,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
@@ -89,7 +88,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
@@ -89,7 +88,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
@@ -89,7 +88,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
@@ -88,7 +87,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -105,7 +103,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
@@ -88,7 +87,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -105,7 +103,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
@@ -88,7 +87,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -105,7 +103,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"), out _);
|
||||
string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"),
|
||||
out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
@@ -105,7 +104,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
@@ -89,7 +88,6 @@ namespace DiscImageChef.Tests.Filters
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace DiscImageChef.Tests.Images
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -137,8 +137,6 @@ namespace DiscImageChef.Commands
|
||||
sectors = inputFormat.Info.Sectors;
|
||||
DicConsole.WriteLine("Sectors {0}", sectors);
|
||||
|
||||
sha1Ctx.Init();
|
||||
|
||||
for(ulong i = 0; i < sectors; i++)
|
||||
{
|
||||
DicConsole.Write("\rEntropying sector {0}", i + 1);
|
||||
|
||||
Reference in New Issue
Block a user