mirror of
https://github.com/aaru-dps/Aaru.Checksums.git
synced 2025-12-16 19:24:29 +00:00
Annotate or remove unused elements.
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.Arm;
|
||||||
@@ -50,6 +51,7 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the Adler-32 algorithm</summary>
|
/// <summary>Implements the Adler-32 algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
public sealed class Adler32Context : IChecksum
|
public sealed class Adler32Context : IChecksum
|
||||||
{
|
{
|
||||||
internal const ushort ADLER_MODULE = 65521;
|
internal const ushort ADLER_MODULE = 65521;
|
||||||
|
|||||||
@@ -30,10 +30,13 @@
|
|||||||
// Copyright © 2011-2023 Natalia Portillo
|
// Copyright © 2011-2023 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Aaru.Checksums;
|
namespace Aaru.Checksums;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the CRC16 algorithm with CCITT polynomial and seed</summary>
|
/// <summary>Implements the CRC16 algorithm with CCITT polynomial and seed</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
public sealed class CRC16CCITTContext : Crc16Context
|
public sealed class CRC16CCITTContext : Crc16Context
|
||||||
{
|
{
|
||||||
/// <summary>CCITT CRC16 polynomial</summary>
|
/// <summary>CCITT CRC16 polynomial</summary>
|
||||||
|
|||||||
@@ -30,10 +30,15 @@
|
|||||||
// Copyright © 2011-2023 Natalia Portillo
|
// Copyright © 2011-2023 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Aaru.Checksums;
|
namespace Aaru.Checksums;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the CRC16 algorithm with IBM polynomial and seed</summary>
|
/// <summary>Implements the CRC16 algorithm with IBM polynomial and seed</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
public sealed class CRC16IBMContext : Crc16Context
|
public sealed class CRC16IBMContext : Crc16Context
|
||||||
{
|
{
|
||||||
internal const ushort CRC16_IBM_POLY = 0xA001;
|
internal const ushort CRC16_IBM_POLY = 0xA001;
|
||||||
@@ -233,6 +238,7 @@ public sealed class CRC16IBMContext : Crc16Context
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
File(filename, out byte[] hash);
|
File(filename, out byte[] hash);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.Arm;
|
||||||
@@ -44,6 +45,10 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements a CRC32 algorithm</summary>
|
/// <summary>Implements a CRC32 algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
public sealed class Crc32Context : IChecksum
|
public sealed class Crc32Context : IChecksum
|
||||||
{
|
{
|
||||||
const uint CRC32_ISO_POLY = 0xEDB88320;
|
const uint CRC32_ISO_POLY = 0xEDB88320;
|
||||||
@@ -524,6 +529,7 @@ public sealed class Crc32Context : IChecksum
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
File(filename, out byte[] hash);
|
File(filename, out byte[] hash);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
@@ -43,12 +44,16 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements a CRC64 algorithm</summary>
|
/// <summary>Implements a CRC64 algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
public sealed class Crc64Context : IChecksum
|
public sealed class Crc64Context : IChecksum
|
||||||
{
|
{
|
||||||
/// <summary>ECMA CRC64 polynomial</summary>
|
/// <summary>ECMA CRC64 polynomial</summary>
|
||||||
public const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42;
|
const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42;
|
||||||
/// <summary>ECMA CRC64 seed</summary>
|
/// <summary>ECMA CRC64 seed</summary>
|
||||||
public const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
|
const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
|
||||||
|
|
||||||
static readonly ulong[][] _ecmaCrc64Table =
|
static readonly ulong[][] _ecmaCrc64Table =
|
||||||
{
|
{
|
||||||
@@ -465,6 +470,7 @@ public sealed class Crc64Context : IChecksum
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
File(filename, out byte[] localHash);
|
File(filename, out byte[] localHash);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
// Disabled because the speed is abnormally slow
|
// Disabled because the speed is abnormally slow
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.Arm;
|
||||||
@@ -46,6 +47,9 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the Fletcher-32 algorithm</summary>
|
/// <summary>Implements the Fletcher-32 algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public sealed class Fletcher32Context : IChecksum
|
public sealed class Fletcher32Context : IChecksum
|
||||||
{
|
{
|
||||||
internal const ushort FLETCHER_MODULE = 0xFFFF;
|
internal const ushort FLETCHER_MODULE = 0xFFFF;
|
||||||
@@ -411,6 +415,9 @@ public sealed class Fletcher32Context : IChecksum
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the Fletcher-16 algorithm</summary>
|
/// <summary>Implements the Fletcher-16 algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
public sealed class Fletcher16Context : IChecksum
|
public sealed class Fletcher16Context : IChecksum
|
||||||
{
|
{
|
||||||
const byte FLETCHER_MODULE = 0xFF;
|
const byte FLETCHER_MODULE = 0xFF;
|
||||||
|
|||||||
@@ -58,11 +58,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
|
|
||||||
namespace Aaru.Checksums;
|
namespace Aaru.Checksums;
|
||||||
|
|
||||||
/// <summary>Implements the Reed-Solomon algorithm</summary>
|
/// <summary>Implements the Reed-Solomon algorithm</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||||
public class ReedSolomon
|
public class ReedSolomon
|
||||||
{
|
{
|
||||||
/// <summary>Alpha exponent for the first root of the generator polynomial</summary>
|
/// <summary>Alpha exponent for the first root of the generator polynomial</summary>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -40,6 +41,9 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Wraps up .NET SHA1 implementation to a Init(), Update(), Final() context.</summary>
|
/// <summary>Wraps up .NET SHA1 implementation to a Init(), Update(), Final() context.</summary>
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
public sealed class Sha1Context : IChecksum
|
public sealed class Sha1Context : IChecksum
|
||||||
{
|
{
|
||||||
readonly SHA1 _provider;
|
readonly SHA1 _provider;
|
||||||
@@ -89,6 +93,7 @@ public sealed class Sha1Context : IChecksum
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
var localSha1Provider = SHA1.Create();
|
var localSha1Provider = SHA1.Create();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -40,6 +41,9 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Wraps up .NET SHA256 implementation to a Init(), Update(), Final() context.</summary>
|
/// <summary>Wraps up .NET SHA256 implementation to a Init(), Update(), Final() context.</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
public sealed class Sha256Context : IChecksum
|
public sealed class Sha256Context : IChecksum
|
||||||
{
|
{
|
||||||
readonly SHA256 _provider;
|
readonly SHA256 _provider;
|
||||||
@@ -89,6 +93,7 @@ public sealed class Sha256Context : IChecksum
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
var localSha256Provider = SHA256.Create();
|
var localSha256Provider = SHA256.Create();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -40,6 +41,10 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Wraps up .NET SHA384 implementation to a Init(), Update(), Final() context.</summary>
|
/// <summary>Wraps up .NET SHA384 implementation to a Init(), Update(), Final() context.</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public sealed class Sha384Context : IChecksum
|
public sealed class Sha384Context : IChecksum
|
||||||
{
|
{
|
||||||
readonly SHA384 _provider;
|
readonly SHA384 _provider;
|
||||||
@@ -89,6 +94,7 @@ public sealed class Sha384Context : IChecksum
|
|||||||
|
|
||||||
/// <summary>Gets the hash of a file</summary>
|
/// <summary>Gets the hash of a file</summary>
|
||||||
/// <param name="filename">File path.</param>
|
/// <param name="filename">File path.</param>
|
||||||
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
|
||||||
public static byte[] File(string filename)
|
public static byte[] File(string filename)
|
||||||
{
|
{
|
||||||
var localSha384Provider = SHA384.Create();
|
var localSha384Provider = SHA384.Create();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -40,6 +41,10 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Wraps up .NET SHA512 implementation to a Init(), Update(), Final() context.</summary>
|
/// <summary>Wraps up .NET SHA512 implementation to a Init(), Update(), Final() context.</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public sealed class Sha512Context : IChecksum
|
public sealed class Sha512Context : IChecksum
|
||||||
{
|
{
|
||||||
readonly SHA512 _provider;
|
readonly SHA512 _provider;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
// http://ssdeep.sf.net/
|
// http://ssdeep.sf.net/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -48,6 +49,11 @@ namespace Aaru.Checksums;
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Implements the SpamSum fuzzy hashing algorithm.</summary>
|
/// <summary>Implements the SpamSum fuzzy hashing algorithm.</summary>
|
||||||
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "UnusedParameter.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
|
[SuppressMessage("ReSharper", "OutParameterValueIsAlwaysDiscarded.Global")]
|
||||||
public sealed class SpamSumContext : IChecksum
|
public sealed class SpamSumContext : IChecksum
|
||||||
{
|
{
|
||||||
const uint ROLLING_WINDOW = 7;
|
const uint ROLLING_WINDOW = 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user