From 7e91888acae87f64f858fc21eec8d4559f6af572 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 12:55:28 +0100 Subject: [PATCH] [IChecksum] Add missing fields for interface. --- Aaru.Checksums.csproj | 1 + Adler32Context.cs | 9 ++ Authors.cs | 37 ++++++++ CRC16CCITTContext.cs | 5 ++ CRC16Context.cs | 9 ++ CRC16IBMContext.cs | 10 +++ CRC32Context.cs | 9 ++ CRC64Context.cs | 9 ++ FletcherContext.cs | 18 ++++ Localization/Localization.Designer.cs | 117 ++++++++++++++++++++++++++ Localization/Localization.es.resx | 39 +++++++++ Localization/Localization.resx | 39 +++++++++ MD5Context.cs | 9 ++ SHA1Context.cs | 9 ++ SHA256Context.cs | 9 ++ SHA384Context.cs | 9 ++ SHA512Context.cs | 9 ++ SpamSumContext.cs | 9 ++ 18 files changed, 356 insertions(+) create mode 100644 Authors.cs diff --git a/Aaru.Checksums.csproj b/Aaru.Checksums.csproj index b699be387..aeedd9044 100644 --- a/Aaru.Checksums.csproj +++ b/Aaru.Checksums.csproj @@ -61,6 +61,7 @@ + diff --git a/Adler32Context.cs b/Adler32Context.cs index 7e52653a0..2fe11c355 100644 --- a/Adler32Context.cs +++ b/Adler32Context.cs @@ -75,6 +75,15 @@ public sealed class Adler32Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.Adler32_Name; + + /// + public Guid Id => new("D69CF1E7-4A7B-4605-9291-3A1BE4C2951F"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/Authors.cs b/Authors.cs new file mode 100644 index 000000000..81ed10ae5 --- /dev/null +++ b/Authors.cs @@ -0,0 +1,37 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : Authors.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru.Checksums. +// +// --[ License ] -------------------------------------------------------------- +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2023 Natalia Portillo +// ****************************************************************************/ + +using System.Diagnostics.CodeAnalysis; + +namespace Aaru.Checksums; + +[SuppressMessage("ReSharper", "InconsistentNaming")] +static class Authors +{ + internal const string NataliaPortillo = "Natalia Portillo"; +} \ No newline at end of file diff --git a/CRC16CCITTContext.cs b/CRC16CCITTContext.cs index a2935ea4c..7f506a69d 100644 --- a/CRC16CCITTContext.cs +++ b/CRC16CCITTContext.cs @@ -30,6 +30,7 @@ // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ +using System; using System.Diagnostics.CodeAnalysis; namespace Aaru.Checksums; @@ -235,6 +236,10 @@ public sealed class CRC16CcittContext : Crc16Context /// public CRC16CcittContext() : base(CRC16_CCITT_POLY, CRC16_CCITT_SEED, _ccittCrc16Table, true) {} + public string Name => Localization.CRC16_CCITT_Name; + public Guid Id => new("4C3BD0D5-24BD-4D45-BC19-A90A5AA5CC9D"); + public string Author => Authors.NataliaPortillo; + /// Gets the hash of a file /// File path. public static byte[] File(string filename) diff --git a/CRC16Context.cs b/CRC16Context.cs index 2e6c496a8..2cc3c4ba0 100644 --- a/CRC16Context.cs +++ b/CRC16Context.cs @@ -86,6 +86,15 @@ public class Crc16Context : IChecksum #region IChecksum Members + /// + public string Name => "Adler-32"; + + /// + public Guid Id => new("D69CF1E7-4A7B-4605-9291-3A1BE4C2951F"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/CRC16IBMContext.cs b/CRC16IBMContext.cs index 70048650d..19baf4787 100644 --- a/CRC16IBMContext.cs +++ b/CRC16IBMContext.cs @@ -30,6 +30,7 @@ // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ +using System; using System.Diagnostics.CodeAnalysis; namespace Aaru.Checksums; @@ -236,6 +237,15 @@ public sealed class CRC16IbmContext : Crc16Context /// public CRC16IbmContext() : base(CRC16_IBM_POLY, CRC16_IBM_SEED, _ibmCrc16Table, false) {} + /// + public string Name => Localization.CRC16_IBM_Name; + + /// + public Guid Id => new("0470433E-0C78-4C37-8C9F-BD8E72340E78"); + + /// + public string Author => Authors.NataliaPortillo; + /// Gets the hash of a file /// File path. // ReSharper disable once ReturnTypeCanBeEnumerable.Global diff --git a/CRC32Context.cs b/CRC32Context.cs index 8823ff388..089fc0461 100644 --- a/CRC32Context.cs +++ b/CRC32Context.cs @@ -354,6 +354,15 @@ public sealed class Crc32Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.CRC32_Name; + + /// + public Guid Id => new("BCC4E18A-79CD-4B52-8A57-2B599E5176B3"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/CRC64Context.cs b/CRC64Context.cs index 822d2a5bc..c0ef7524f 100644 --- a/CRC64Context.cs +++ b/CRC64Context.cs @@ -319,6 +319,15 @@ public sealed class Crc64Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.CRC64_ECMA_Name; + + /// + public Guid Id => new("D0C0D902-420A-45DA-A235-9D48BEE4B1CE"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/FletcherContext.cs b/FletcherContext.cs index c42e3c2ab..8ca63928f 100644 --- a/FletcherContext.cs +++ b/FletcherContext.cs @@ -73,6 +73,15 @@ public sealed class Fletcher32Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.Fletcher32_Name; + + /// + public Guid Id => new("0E51B39F-C5E6-4CED-9E59-BA5A42B3B2F4"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. @@ -442,6 +451,15 @@ public sealed class Fletcher16Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.Fletcher16_Name; + + /// + public Guid Id => new("80C51F1D-71F8-4741-A0CF-18FA8102EE4B"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/Localization/Localization.Designer.cs b/Localization/Localization.Designer.cs index ce5945835..2a0b2bcce 100644 --- a/Localization/Localization.Designer.cs +++ b/Localization/Localization.Designer.cs @@ -59,6 +59,15 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to Adler-32. + /// + internal static string Adler32_Name { + get { + return ResourceManager.GetString("Adler32_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Assertion failed. /// @@ -104,6 +113,42 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to CRC-16 (CCITT). + /// + internal static string CRC16_CCITT_Name { + get { + return ResourceManager.GetString("CRC16_CCITT_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CRC-16 (IBM). + /// + internal static string CRC16_IBM_Name { + get { + return ResourceManager.GetString("CRC16_IBM_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CRC-32. + /// + internal static string CRC32_Name { + get { + return ResourceManager.GetString("CRC32_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CRC-64 (ECMA). + /// + internal static string CRC64_ECMA_Name { + get { + return ResourceManager.GetString("CRC64_ECMA_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}. /// @@ -235,6 +280,24 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to Fletcher-16. + /// + internal static string Fletcher16_Name { + get { + return ResourceManager.GetString("Fletcher16_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Fletcher-32. + /// + internal static string Fletcher32_Name { + get { + return ResourceManager.GetString("Fletcher32_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to /// lambda(x) is WRONG @@ -255,6 +318,15 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to MD5. + /// + internal static string MD5_Name { + get { + return ResourceManager.GetString("MD5_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Not yet implemented.. /// @@ -273,6 +345,42 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to SHA1. + /// + internal static string SHA1_Name { + get { + return ResourceManager.GetString("SHA1_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SHA256. + /// + internal static string SHA256_Name { + get { + return ResourceManager.GetString("SHA256_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SHA384. + /// + internal static string SHA384_Name { + get { + return ResourceManager.GetString("SHA384_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SHA512. + /// + internal static string SHA512_Name { + get { + return ResourceManager.GetString("SHA512_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to SpamSum does not have a binary representation.. /// @@ -282,6 +390,15 @@ namespace Aaru.Checksums { } } + /// + /// Looks up a localized string similar to SpamSum. + /// + internal static string SpamSum_Name { + get { + return ResourceManager.GetString("SpamSum_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to The input exceeds data types.. /// diff --git a/Localization/Localization.es.resx b/Localization/Localization.es.resx index 72696ac27..9f9a0e949 100644 --- a/Localization/Localization.es.resx +++ b/Localization/Localization.es.resx @@ -94,4 +94,43 @@ ¡Intentando calcular RS sin inicializar! + + Adler-32 + + + CRC-16 (CCITT) + + + CRC-16 (IBM) + + + CRC-32 + + + CRC-64 (ECMA) + + + Fletcher-32 + + + Fletcher-16 + + + MD5 + + + SHA1 + + + SHA256 + + + SHA384 + + + SHA512 + + + SpamSum + \ No newline at end of file diff --git a/Localization/Localization.resx b/Localization/Localization.resx index 68d598247..4d624dda0 100644 --- a/Localization/Localization.resx +++ b/Localization/Localization.resx @@ -108,4 +108,43 @@ Not yet implemented. + + Adler-32 + + + CRC-16 (CCITT) + + + CRC-16 (IBM) + + + CRC-32 + + + CRC-64 (ECMA) + + + Fletcher-32 + + + Fletcher-16 + + + MD5 + + + SHA1 + + + SHA256 + + + SHA384 + + + SHA512 + + + SpamSum + \ No newline at end of file diff --git a/MD5Context.cs b/MD5Context.cs index 10b7eb1ba..692c5e83a 100644 --- a/MD5Context.cs +++ b/MD5Context.cs @@ -49,6 +49,15 @@ public sealed class Md5Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.MD5_Name; + + /// + public Guid Id => new("C78674C4-F699-4FAB-A618-1661AF659A7C"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/SHA1Context.cs b/SHA1Context.cs index 4f7c41809..c796f3a51 100644 --- a/SHA1Context.cs +++ b/SHA1Context.cs @@ -53,6 +53,15 @@ public sealed class Sha1Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.SHA1_Name; + + /// + public Guid Id => new("5C28939D-DCBB-4C6E-8498-C509ABD99FC2"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/SHA256Context.cs b/SHA256Context.cs index 4bb6a913c..ccf00ff79 100644 --- a/SHA256Context.cs +++ b/SHA256Context.cs @@ -53,6 +53,15 @@ public sealed class Sha256Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.SHA256_Name; + + /// + public Guid Id => new("A6F0EF52-064D-41D1-8619-240481749B70"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/SHA384Context.cs b/SHA384Context.cs index d1bc1a4d3..73b6aeef9 100644 --- a/SHA384Context.cs +++ b/SHA384Context.cs @@ -54,6 +54,15 @@ public sealed class Sha384Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.SHA384_Name; + + /// + public Guid Id => new("4A2A1820-E157-4842-B1E2-0E629FA60DDD"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/SHA512Context.cs b/SHA512Context.cs index 5ca05fbae..203ebde8f 100644 --- a/SHA512Context.cs +++ b/SHA512Context.cs @@ -54,6 +54,15 @@ public sealed class Sha512Context : IChecksum #region IChecksum Members + /// + public string Name => Localization.SHA512_Name; + + /// + public Guid Id => new("1E167BCB-2362-44DA-B5B0-B7ED3A22D5A6"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer. diff --git a/SpamSumContext.cs b/SpamSumContext.cs index 8bde1fd87..6c0db8c61 100644 --- a/SpamSumContext.cs +++ b/SpamSumContext.cs @@ -92,6 +92,15 @@ public sealed class SpamSumContext : IChecksum #region IChecksum Members + /// + public string Name => Localization.SpamSum_Name; + + /// + public Guid Id => new("DA692981-3291-47D8-B8B9-A87F0605F6E9"); + + /// + public string Author => Authors.NataliaPortillo; + /// /// Updates the hash with data. /// Data buffer.