Annotate or remove unused elements.

This commit is contained in:
2023-10-05 01:05:19 +01:00
parent 16b2a40390
commit 86c470a436
12 changed files with 62 additions and 2 deletions

View File

@@ -37,6 +37,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.Arm;
@@ -50,6 +51,7 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <summary>Implements the Adler-32 algorithm</summary>
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
public sealed class Adler32Context : IChecksum
{
internal const ushort ADLER_MODULE = 65521;

View File

@@ -30,10 +30,13 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Checksums;
/// <inheritdoc />
/// <summary>Implements the CRC16 algorithm with CCITT polynomial and seed</summary>
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
public sealed class CRC16CCITTContext : Crc16Context
{
/// <summary>CCITT CRC16 polynomial</summary>

View File

@@ -30,10 +30,15 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
internal const ushort CRC16_IBM_POLY = 0xA001;
@@ -233,6 +238,7 @@ public sealed class CRC16IBMContext : Crc16Context
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
File(filename, out byte[] hash);

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.Arm;
@@ -44,6 +45,10 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
const uint CRC32_ISO_POLY = 0xEDB88320;
@@ -524,6 +529,7 @@ public sealed class Crc32Context : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
File(filename, out byte[] hash);

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
@@ -43,12 +44,16 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
/// <summary>ECMA CRC64 polynomial</summary>
public const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42;
const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42;
/// <summary>ECMA CRC64 seed</summary>
public const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
static readonly ulong[][] _ecmaCrc64Table =
{
@@ -465,6 +470,7 @@ public sealed class Crc64Context : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
File(filename, out byte[] localHash);

View File

@@ -33,6 +33,7 @@
// Disabled because the speed is abnormally slow
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.Arm;
@@ -46,6 +47,9 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <summary>Implements the Fletcher-32 algorithm</summary>
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public sealed class Fletcher32Context : IChecksum
{
internal const ushort FLETCHER_MODULE = 0xFFFF;
@@ -411,6 +415,9 @@ public sealed class Fletcher32Context : IChecksum
/// <inheritdoc />
/// <summary>Implements the Fletcher-16 algorithm</summary>
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
public sealed class Fletcher16Context : IChecksum
{
const byte FLETCHER_MODULE = 0xFF;

View File

@@ -58,11 +58,14 @@
*/
using System;
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
namespace Aaru.Checksums;
/// <summary>Implements the Reed-Solomon algorithm</summary>
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedType.Global")]
public class ReedSolomon
{
/// <summary>Alpha exponent for the first root of the generator polynomial</summary>

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -40,6 +41,9 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
readonly SHA1 _provider;
@@ -89,6 +93,7 @@ public sealed class Sha1Context : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
var localSha1Provider = SHA1.Create();

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -40,6 +41,9 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
readonly SHA256 _provider;
@@ -89,6 +93,7 @@ public sealed class Sha256Context : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
var localSha256Provider = SHA256.Create();

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -40,6 +41,10 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
readonly SHA384 _provider;
@@ -89,6 +94,7 @@ public sealed class Sha384Context : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public static byte[] File(string filename)
{
var localSha384Provider = SHA384.Create();

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -40,6 +41,10 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
readonly SHA512 _provider;

View File

@@ -40,6 +40,7 @@
// http://ssdeep.sf.net/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
using Aaru.CommonTypes.Interfaces;
@@ -48,6 +49,11 @@ namespace Aaru.Checksums;
/// <inheritdoc />
/// <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
{
const uint ROLLING_WINDOW = 7;