mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code restyling.
This commit is contained in:
@@ -36,8 +36,29 @@ namespace Aaru.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Adler32
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0xf0, 0x00, 0x01};
|
||||
static readonly byte[] ExpectedRandom = {0x37, 0x28, 0xd1, 0x86};
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0x00, 0xf0, 0x00, 0x01
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x37, 0x28, 0xd1, 0x86
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Adler32EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Adler32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32EmptyFile()
|
||||
@@ -46,25 +67,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Adler32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -74,6 +84,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Adler32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32RandomFile()
|
||||
{
|
||||
@@ -81,25 +106,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Adler32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler32RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -36,26 +36,34 @@ namespace Aaru.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc16
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0x00};
|
||||
static readonly byte[] ExpectedRandom = {0x2d, 0x6d};
|
||||
|
||||
[Test]
|
||||
public void Crc16EmptyFile()
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
byte[] result = Crc16Context.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
0x00, 0x00
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x2d, 0x6d
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Crc16EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc16Context.Data(data, out byte[] result);
|
||||
CRC16CCITTContext.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc16EmptyFile()
|
||||
{
|
||||
byte[] result = CRC16CCITTContext.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
@@ -63,34 +71,38 @@ namespace Aaru.Tests.Checksums
|
||||
public void Crc16EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc16Context();
|
||||
IChecksum ctx = new CRC16CCITTContext();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc16RandomFile()
|
||||
public void Crc16RandomData()
|
||||
{
|
||||
byte[] result = Crc16Context.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
CRC16CCITTContext.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc16RandomData()
|
||||
public void Crc16RandomFile()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc16Context.Data(data, out byte[] result);
|
||||
byte[] result = CRC16CCITTContext.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
@@ -98,12 +110,14 @@ namespace Aaru.Tests.Checksums
|
||||
public void Crc16RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc16Context();
|
||||
IChecksum ctx = new CRC16CCITTContext();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -36,8 +36,29 @@ namespace Aaru.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc32
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0xa7, 0x38, 0xea, 0x1c};
|
||||
static readonly byte[] ExpectedRandom = {0x2b, 0x6e, 0x68, 0x54};
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0xa7, 0x38, 0xea, 0x1c
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x2b, 0x6e, 0x68, 0x54
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Crc32EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32EmptyFile()
|
||||
@@ -46,25 +67,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -74,6 +84,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32RandomFile()
|
||||
{
|
||||
@@ -81,25 +106,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc32Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc32RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -36,8 +36,29 @@ namespace Aaru.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc64
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2};
|
||||
static readonly byte[] ExpectedRandom = {0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e};
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Crc64EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc64Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64EmptyFile()
|
||||
@@ -46,25 +67,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc64Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -74,6 +84,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc64Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64RandomFile()
|
||||
{
|
||||
@@ -81,25 +106,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Crc64Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crc64RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -45,19 +45,14 @@ namespace Aaru.Tests.Checksums
|
||||
0xd7, 0x8f, 0x0e, 0xec, 0x41, 0x7b, 0xe3, 0x86, 0x21, 0x9b, 0x21, 0xb7, 0x00, 0x04, 0x4b, 0x95
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Md5EmptyFile()
|
||||
{
|
||||
byte[] result = Md5Context.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -65,12 +60,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5EmptyFile()
|
||||
{
|
||||
byte[] result = Md5Context.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -80,6 +84,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Md5Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5RandomFile()
|
||||
{
|
||||
@@ -87,25 +106,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Md5Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -38,15 +38,30 @@ namespace Aaru.Tests.Checksums
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0x3b, 0x71, 0xf4, 0x3f, 0xf3, 0x0f, 0x4b, 0x15, 0xb5, 0xcd, 0x85, 0xdd, 0x9e, 0x95, 0xeb, 0xc7, 0xe8,
|
||||
0x4e, 0xb5, 0xa3
|
||||
0x3b, 0x71, 0xf4, 0x3f, 0xf3, 0x0f, 0x4b, 0x15, 0xb5, 0xcd, 0x85, 0xdd, 0x9e, 0x95, 0xeb, 0xc7, 0xe8, 0x4e,
|
||||
0xb5, 0xa3
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x72, 0x0d, 0x3b, 0x71, 0x7d, 0xe0, 0xc7, 0x4c, 0x77, 0xdd, 0x9c, 0xaa, 0x9e, 0xba, 0x50, 0x60, 0xdc,
|
||||
0xbd, 0x28, 0x8d
|
||||
0x72, 0x0d, 0x3b, 0x71, 0x7d, 0xe0, 0xc7, 0x4c, 0x77, 0xdd, 0x9c, 0xaa, 0x9e, 0xba, 0x50, 0x60, 0xdc, 0xbd,
|
||||
0x28, 0x8d
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Sha1EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1EmptyFile()
|
||||
{
|
||||
@@ -54,25 +69,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -82,6 +86,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1RandomFile()
|
||||
{
|
||||
@@ -89,25 +108,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha1Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -38,15 +38,30 @@ namespace Aaru.Tests.Checksums
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0x30, 0xe1, 0x49, 0x55, 0xeb, 0xf1, 0x35, 0x22, 0x66, 0xdc, 0x2f, 0xf8, 0x06, 0x7e, 0x68, 0x10, 0x46,
|
||||
0x07, 0xe7, 0x50, 0xab, 0xb9, 0xd3, 0xb3, 0x65, 0x82, 0xb8, 0xaf, 0x90, 0x9f, 0xcb, 0x58
|
||||
0x30, 0xe1, 0x49, 0x55, 0xeb, 0xf1, 0x35, 0x22, 0x66, 0xdc, 0x2f, 0xf8, 0x06, 0x7e, 0x68, 0x10, 0x46, 0x07,
|
||||
0xe7, 0x50, 0xab, 0xb9, 0xd3, 0xb3, 0x65, 0x82, 0xb8, 0xaf, 0x90, 0x9f, 0xcb, 0x58
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x4d, 0x1a, 0x6b, 0x8a, 0x54, 0x67, 0x00, 0xc4, 0x8e, 0xda, 0x70, 0xd3, 0x39, 0x1c, 0x8f, 0x15, 0x8a,
|
||||
0x8d, 0x12, 0xb2, 0x38, 0x92, 0x89, 0x29, 0x50, 0x47, 0x8c, 0x41, 0x8e, 0x25, 0xcc, 0x39
|
||||
0x4d, 0x1a, 0x6b, 0x8a, 0x54, 0x67, 0x00, 0xc4, 0x8e, 0xda, 0x70, 0xd3, 0x39, 0x1c, 0x8f, 0x15, 0x8a, 0x8d,
|
||||
0x12, 0xb2, 0x38, 0x92, 0x89, 0x29, 0x50, 0x47, 0x8c, 0x41, 0x8e, 0x25, 0xcc, 0x39
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Sha256EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256EmptyFile()
|
||||
{
|
||||
@@ -54,25 +69,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -82,6 +86,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256RandomFile()
|
||||
{
|
||||
@@ -89,25 +108,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha256Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -38,17 +38,32 @@ namespace Aaru.Tests.Checksums
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0x31, 0x64, 0x67, 0x3a, 0x8a, 0xc2, 0x75, 0x76, 0xab, 0x5f, 0xc0, 0x6b, 0x9a, 0xdc, 0x4c, 0xe0, 0xac,
|
||||
0xa5, 0xbd, 0x30, 0x25, 0x38, 0x4b, 0x1c, 0xf2, 0x12, 0x8a, 0x87, 0x95, 0xe7, 0x47, 0xc4, 0x31, 0xe8,
|
||||
0x82, 0x78, 0x5a, 0x0b, 0xf8, 0xdc, 0x70, 0xb4, 0x29, 0x95, 0xdb, 0x38, 0x85, 0x75
|
||||
0x31, 0x64, 0x67, 0x3a, 0x8a, 0xc2, 0x75, 0x76, 0xab, 0x5f, 0xc0, 0x6b, 0x9a, 0xdc, 0x4c, 0xe0, 0xac, 0xa5,
|
||||
0xbd, 0x30, 0x25, 0x38, 0x4b, 0x1c, 0xf2, 0x12, 0x8a, 0x87, 0x95, 0xe7, 0x47, 0xc4, 0x31, 0xe8, 0x82, 0x78,
|
||||
0x5a, 0x0b, 0xf8, 0xdc, 0x70, 0xb4, 0x29, 0x95, 0xdb, 0x38, 0x85, 0x75
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0xdb, 0x53, 0x0e, 0x17, 0x9b, 0x81, 0xfe, 0x5f, 0x6d, 0x20, 0x41, 0x04, 0x6e, 0x77, 0xd9, 0x85, 0xf2,
|
||||
0x85, 0x8a, 0x66, 0xca, 0xd3, 0x8d, 0x1a, 0xd5, 0xac, 0x67, 0xa9, 0x74, 0xe1, 0xef, 0x3f, 0x4d, 0xdf,
|
||||
0x94, 0x15, 0x2e, 0xac, 0x2e, 0xfe, 0x16, 0x95, 0x81, 0x54, 0xdc, 0x59, 0xd4, 0xc3
|
||||
0xdb, 0x53, 0x0e, 0x17, 0x9b, 0x81, 0xfe, 0x5f, 0x6d, 0x20, 0x41, 0x04, 0x6e, 0x77, 0xd9, 0x85, 0xf2, 0x85,
|
||||
0x8a, 0x66, 0xca, 0xd3, 0x8d, 0x1a, 0xd5, 0xac, 0x67, 0xa9, 0x74, 0xe1, 0xef, 0x3f, 0x4d, 0xdf, 0x94, 0x15,
|
||||
0x2e, 0xac, 0x2e, 0xfe, 0x16, 0x95, 0x81, 0x54, 0xdc, 0x59, 0xd4, 0xc3
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Sha384EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384EmptyFile()
|
||||
{
|
||||
@@ -56,25 +71,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -84,6 +88,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384RandomFile()
|
||||
{
|
||||
@@ -91,25 +110,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha384Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -38,19 +38,34 @@ namespace Aaru.Tests.Checksums
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty =
|
||||
{
|
||||
0xd6, 0x29, 0x26, 0x85, 0xb3, 0x80, 0xe3, 0x38, 0xe0, 0x25, 0xb3, 0x41, 0x5a, 0x90, 0xfe, 0x8f, 0x9d,
|
||||
0x39, 0xa4, 0x6e, 0x7b, 0xdb, 0xa8, 0xcb, 0x78, 0xc5, 0x0a, 0x33, 0x8c, 0xef, 0xca, 0x74, 0x1f, 0x69,
|
||||
0xe4, 0xe4, 0x64, 0x11, 0xc3, 0x2d, 0xe1, 0xaf, 0xde, 0xdf, 0xb2, 0x68, 0xe5, 0x79, 0xa5, 0x1f, 0x81,
|
||||
0xff, 0x85, 0xe5, 0x6f, 0x55, 0xb0, 0xee, 0x7c, 0x33, 0xfe, 0x8c, 0x25, 0xc9
|
||||
0xd6, 0x29, 0x26, 0x85, 0xb3, 0x80, 0xe3, 0x38, 0xe0, 0x25, 0xb3, 0x41, 0x5a, 0x90, 0xfe, 0x8f, 0x9d, 0x39,
|
||||
0xa4, 0x6e, 0x7b, 0xdb, 0xa8, 0xcb, 0x78, 0xc5, 0x0a, 0x33, 0x8c, 0xef, 0xca, 0x74, 0x1f, 0x69, 0xe4, 0xe4,
|
||||
0x64, 0x11, 0xc3, 0x2d, 0xe1, 0xaf, 0xde, 0xdf, 0xb2, 0x68, 0xe5, 0x79, 0xa5, 0x1f, 0x81, 0xff, 0x85, 0xe5,
|
||||
0x6f, 0x55, 0xb0, 0xee, 0x7c, 0x33, 0xfe, 0x8c, 0x25, 0xc9
|
||||
};
|
||||
static readonly byte[] ExpectedRandom =
|
||||
{
|
||||
0x6a, 0x0a, 0x18, 0xc2, 0xad, 0xf8, 0x83, 0xac, 0x58, 0xe6, 0x21, 0x96, 0xdb, 0x8d, 0x3d, 0x0e, 0xb9,
|
||||
0x87, 0xd1, 0x49, 0x24, 0x97, 0xdb, 0x15, 0xb9, 0xfc, 0xcc, 0xb0, 0x36, 0xdf, 0x64, 0xae, 0xdb, 0x3e,
|
||||
0x82, 0xa0, 0x4d, 0xdc, 0xd1, 0x37, 0x48, 0x92, 0x95, 0x51, 0xf9, 0xdd, 0xab, 0x82, 0xf4, 0x8a, 0x85,
|
||||
0x3f, 0x9a, 0x01, 0xb5, 0xf2, 0x8c, 0xbb, 0x4a, 0xa5, 0x1b, 0x40, 0x7c, 0xb6
|
||||
0x6a, 0x0a, 0x18, 0xc2, 0xad, 0xf8, 0x83, 0xac, 0x58, 0xe6, 0x21, 0x96, 0xdb, 0x8d, 0x3d, 0x0e, 0xb9, 0x87,
|
||||
0xd1, 0x49, 0x24, 0x97, 0xdb, 0x15, 0xb9, 0xfc, 0xcc, 0xb0, 0x36, 0xdf, 0x64, 0xae, 0xdb, 0x3e, 0x82, 0xa0,
|
||||
0x4d, 0xdc, 0xd1, 0x37, 0x48, 0x92, 0x95, 0x51, 0xf9, 0xdd, 0xab, 0x82, 0xf4, 0x8a, 0x85, 0x3f, 0x9a, 0x01,
|
||||
0xb5, 0xf2, 0x8c, 0xbb, 0x4a, 0xa5, 0x1b, 0x40, 0x7c, 0xb6
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Sha512EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512EmptyFile()
|
||||
{
|
||||
@@ -58,25 +73,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -86,6 +90,21 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512RandomFile()
|
||||
{
|
||||
@@ -93,25 +112,14 @@ namespace Aaru.Tests.Checksums
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
@@ -43,8 +43,10 @@ namespace Aaru.Tests.Checksums
|
||||
public void SpamSumEmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -56,8 +58,10 @@ namespace Aaru.Tests.Checksums
|
||||
public void SpamSumEmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -71,8 +75,10 @@ namespace Aaru.Tests.Checksums
|
||||
public void SpamSumRandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -84,8 +90,10 @@ namespace Aaru.Tests.Checksums
|
||||
public void SpamSumRandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user