mirror of
https://github.com/aaru-dps/Aaru.Checksums.git
synced 2025-12-16 19:24:29 +00:00
Inherit documentation.
This commit is contained in:
@@ -49,6 +49,7 @@ namespace Aaru.Checksums
|
|||||||
sum2 = 0;
|
sum2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -61,10 +62,12 @@ namespace Aaru.Checksums
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -73,6 +76,7 @@ namespace Aaru.Checksums
|
|||||||
return BigEndianBitConverter.GetBytes(finalSum);
|
return BigEndianBitConverter.GetBytes(finalSum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -410,85 +410,69 @@ namespace Aaru.Checksums
|
|||||||
|
|
||||||
for(int j = 0; j < 18; j++)
|
for(int j = 0; j < 18; j++)
|
||||||
{
|
{
|
||||||
if(j < 18)
|
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x3F) << 2));
|
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4));
|
cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x0F) << 4));
|
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x0F) << 4));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2));
|
cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x03) << 6));
|
cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x03) << 6));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F));
|
cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < 18; j++)
|
for(int j = 0; j < 18; j++)
|
||||||
{
|
{
|
||||||
if(j < 18)
|
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x3F) << 2));
|
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4));
|
cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x0F) << 4));
|
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x0F) << 4));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2));
|
cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x03) << 6));
|
cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x03) << 6));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F));
|
cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < 18; j++)
|
for(int j = 0; j < 18; j++)
|
||||||
{
|
{
|
||||||
if(j < 18)
|
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x3F) << 2));
|
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4));
|
cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x0F) << 4));
|
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x0F) << 4));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2));
|
cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x03) << 6));
|
cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x03) << 6));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F));
|
cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < 18; j++)
|
for(int j = 0; j < 18; j++)
|
||||||
{
|
{
|
||||||
if(j < 18)
|
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x3F) << 2));
|
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4));
|
cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x0F) << 4));
|
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x0F) << 4));
|
||||||
|
|
||||||
if(j < 18)
|
if(j < 17)
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2));
|
cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x03) << 6));
|
cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x03) << 6));
|
||||||
|
|
||||||
if(j < 18)
|
|
||||||
cdTextPack4[j] = (byte)(cdTextPack4[j] | (subchannel[i++] & 0x3F));
|
cdTextPack4[j] = (byte)(cdTextPack4[j] | (subchannel[i++] & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace Aaru.Checksums
|
|||||||
_table = table ?? GenerateTable(polynomial, inverse);
|
_table = table ?? GenerateTable(polynomial, inverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -69,13 +70,16 @@ namespace Aaru.Checksums
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final() => BigEndianBitConverter.GetBytes((ushort)(_hashInt ^ _finalSeed));
|
public byte[] Final() => BigEndianBitConverter.GetBytes((ushort)(_hashInt ^ _finalSeed));
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace Aaru.Checksums
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -101,13 +102,16 @@ namespace Aaru.Checksums
|
|||||||
hashInt = (hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xff)];
|
hashInt = (hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xff)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^ finalSeed);
|
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^ finalSeed);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace Aaru.Checksums
|
|||||||
finalSeed = seed;
|
finalSeed = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -101,13 +102,16 @@ namespace Aaru.Checksums
|
|||||||
hashInt = (hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xff)];
|
hashInt = (hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xff)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^= finalSeed);
|
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^= finalSeed);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ namespace Aaru.Checksums
|
|||||||
sum2 = 0xFFFF;
|
sum2 = 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -63,10 +64,12 @@ namespace Aaru.Checksums
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -75,6 +78,7 @@ namespace Aaru.Checksums
|
|||||||
return BigEndianBitConverter.GetBytes(finalSum);
|
return BigEndianBitConverter.GetBytes(finalSum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
@@ -172,6 +176,7 @@ namespace Aaru.Checksums
|
|||||||
sum2 = 0xFF;
|
sum2 = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -184,10 +189,12 @@ namespace Aaru.Checksums
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -196,6 +203,7 @@ namespace Aaru.Checksums
|
|||||||
return BigEndianBitConverter.GetBytes(finalSum);
|
return BigEndianBitConverter.GetBytes(finalSum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,15 +45,18 @@ namespace Aaru.Checksums
|
|||||||
/// <summary>Initializes the MD5 hash provider</summary>
|
/// <summary>Initializes the MD5 hash provider</summary>
|
||||||
public Md5Context() => md5Provider = MD5.Create();
|
public Md5Context() => md5Provider = MD5.Create();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
public void Update(byte[] data, uint len) => md5Provider.TransformBlock(data, 0, (int)len, data, 0);
|
public void Update(byte[] data, uint len) => md5Provider.TransformBlock(data, 0, (int)len, data, 0);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ namespace Aaru.Checksums
|
|||||||
return md5Provider.Hash;
|
return md5Provider.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,15 +45,18 @@ namespace Aaru.Checksums
|
|||||||
/// <summary>Initializes the SHA1 hash provider</summary>
|
/// <summary>Initializes the SHA1 hash provider</summary>
|
||||||
public Sha1Context() => sha1Provider = SHA1.Create();
|
public Sha1Context() => sha1Provider = SHA1.Create();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
public void Update(byte[] data, uint len) => sha1Provider.TransformBlock(data, 0, (int)len, data, 0);
|
public void Update(byte[] data, uint len) => sha1Provider.TransformBlock(data, 0, (int)len, data, 0);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ namespace Aaru.Checksums
|
|||||||
return sha1Provider.Hash;
|
return sha1Provider.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,15 +45,18 @@ namespace Aaru.Checksums
|
|||||||
/// <summary>Initializes the SHA256 hash provider</summary>
|
/// <summary>Initializes the SHA256 hash provider</summary>
|
||||||
public Sha256Context() => sha256Provider = SHA256.Create();
|
public Sha256Context() => sha256Provider = SHA256.Create();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
public void Update(byte[] data, uint len) => sha256Provider.TransformBlock(data, 0, (int)len, data, 0);
|
public void Update(byte[] data, uint len) => sha256Provider.TransformBlock(data, 0, (int)len, data, 0);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ namespace Aaru.Checksums
|
|||||||
return sha256Provider.Hash;
|
return sha256Provider.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,15 +45,18 @@ namespace Aaru.Checksums
|
|||||||
/// <summary>Initializes the SHA384 hash provider</summary>
|
/// <summary>Initializes the SHA384 hash provider</summary>
|
||||||
public Sha384Context() => sha384Provider = SHA384.Create();
|
public Sha384Context() => sha384Provider = SHA384.Create();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
public void Update(byte[] data, uint len) => sha384Provider.TransformBlock(data, 0, (int)len, data, 0);
|
public void Update(byte[] data, uint len) => sha384Provider.TransformBlock(data, 0, (int)len, data, 0);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ namespace Aaru.Checksums
|
|||||||
return sha384Provider.Hash;
|
return sha384Provider.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,15 +45,18 @@ namespace Aaru.Checksums
|
|||||||
/// <summary>Initializes the SHA512 hash provider</summary>
|
/// <summary>Initializes the SHA512 hash provider</summary>
|
||||||
public Sha512Context() => sha512Provider = SHA512.Create();
|
public Sha512Context() => sha512Provider = SHA512.Create();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
public void Update(byte[] data, uint len) => sha512Provider.TransformBlock(data, 0, (int)len, data, 0);
|
public void Update(byte[] data, uint len) => sha512Provider.TransformBlock(data, 0, (int)len, data, 0);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ namespace Aaru.Checksums
|
|||||||
return sha512Provider.Hash;
|
return sha512Provider.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ namespace Aaru.Checksums
|
|||||||
roll_init();
|
roll_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
/// <param name="len">Length of buffer to hash.</param>
|
/// <param name="len">Length of buffer to hash.</param>
|
||||||
@@ -101,13 +102,16 @@ namespace Aaru.Checksums
|
|||||||
fuzzy_engine_step(data[i]);
|
fuzzy_engine_step(data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Updates the hash with data.</summary>
|
/// <summary>Updates the hash with data.</summary>
|
||||||
/// <param name="data">Data buffer.</param>
|
/// <param name="data">Data buffer.</param>
|
||||||
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
public void Update(byte[] data) => Update(data, (uint)data.Length);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a byte array of the hash value.</summary>
|
/// <summary>Returns a byte array of the hash value.</summary>
|
||||||
public byte[] Final() => throw new NotImplementedException("SpamSum does not have a binary representation.");
|
public byte[] Final() => throw new NotImplementedException("SpamSum does not have a binary representation.");
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>Returns a base64 representation of the hash value.</summary>
|
/// <summary>Returns a base64 representation of the hash value.</summary>
|
||||||
public string End()
|
public string End()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user