diff --git a/Adler32Context.cs b/Adler32Context.cs index 3cd3ac2..78fc6d5 100644 --- a/Adler32Context.cs +++ b/Adler32Context.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Checksums { /// Implements the Adler-32 algorithm - public class Adler32Context : IChecksum + public sealed class Adler32Context : IChecksum { const ushort ADLER_MODULE = 65521; ushort _sum1, _sum2; diff --git a/CRC16CCITTContext.cs b/CRC16CCITTContext.cs index 3c4c748..daa7743 100644 --- a/CRC16CCITTContext.cs +++ b/CRC16CCITTContext.cs @@ -32,7 +32,7 @@ namespace Aaru.Checksums { - public class CRC16CCITTContext : Crc16Context + public sealed class CRC16CCITTContext : Crc16Context { public const ushort CRC16_CCITT_POLY = 0x8408; public const ushort CRC16_CCITT_SEED = 0x0000; diff --git a/CRC16Context.cs b/CRC16Context.cs index aa59f88..91a1013 100644 --- a/CRC16Context.cs +++ b/CRC16Context.cs @@ -41,10 +41,10 @@ namespace Aaru.Checksums /// Implements a CRC16 algorithm public class Crc16Context : IChecksum { - protected ushort _finalSeed; - protected ushort _hashInt; - protected bool _inverse; - protected ushort[] _table; + readonly ushort _finalSeed; + readonly bool _inverse; + readonly ushort[] _table; + ushort _hashInt; /// Initializes the CRC16 table with a custom polynomial and seed public Crc16Context(ushort polynomial, ushort seed, ushort[] table, bool inverse) diff --git a/CRC16IBMContext.cs b/CRC16IBMContext.cs index 31177db..a9910f0 100644 --- a/CRC16IBMContext.cs +++ b/CRC16IBMContext.cs @@ -32,7 +32,7 @@ namespace Aaru.Checksums { - public class CRC16IBMContext : Crc16Context + public sealed class CRC16IBMContext : Crc16Context { const ushort CRC16_IBM_POLY = 0xA001; const ushort CRC16_IBM_SEED = 0x0000; diff --git a/CRC32Context.cs b/CRC32Context.cs index 3d8f084..e4c3745 100644 --- a/CRC32Context.cs +++ b/CRC32Context.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Checksums { /// Implements a CRC32 algorithm - public class Crc32Context : IChecksum + public sealed class Crc32Context : IChecksum { const uint CRC32_ISO_POLY = 0xEDB88320; const uint CRC32_ISO_SEED = 0xFFFFFFFF; diff --git a/CRC64Context.cs b/CRC64Context.cs index 8decdd1..d9bc026 100644 --- a/CRC64Context.cs +++ b/CRC64Context.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Checksums { /// Implements a CRC64 algorithm - public class Crc64Context : IChecksum + public sealed class Crc64Context : IChecksum { public const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42; public const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF; diff --git a/FletcherContext.cs b/FletcherContext.cs index c369180..fed4021 100644 --- a/FletcherContext.cs +++ b/FletcherContext.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Checksums { /// Implements the Fletcher-32 algorithm - public class Fletcher32Context : IChecksum + public sealed class Fletcher32Context : IChecksum { const ushort FLETCHER_MODULE = 0xFFFF; ushort _sum1, _sum2; @@ -165,7 +165,7 @@ namespace Aaru.Checksums } /// Implements the Fletcher-16 algorithm - public class Fletcher16Context : IChecksum + public sealed class Fletcher16Context : IChecksum { const byte FLETCHER_MODULE = 0xFF; byte _sum1, _sum2; diff --git a/MD5Context.cs b/MD5Context.cs index 4852b3b..95ff00b 100644 --- a/MD5Context.cs +++ b/MD5Context.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Wraps up .NET MD5 implementation to a Init(), Update(), Final() context. - public class Md5Context : IChecksum + public sealed class Md5Context : IChecksum { readonly MD5 _provider; diff --git a/Register.cs b/Register.cs index 9ad89ce..99f7760 100644 --- a/Register.cs +++ b/Register.cs @@ -44,7 +44,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { - public class Register : IPluginRegister + public sealed class Register : IPluginRegister { public List GetAllChecksumPlugins() => Assembly. GetExecutingAssembly().GetTypes(). diff --git a/SHA1Context.cs b/SHA1Context.cs index 86e4b14..a054b2a 100644 --- a/SHA1Context.cs +++ b/SHA1Context.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Wraps up .NET SHA1 implementation to a Init(), Update(), Final() context. - public class Sha1Context : IChecksum + public sealed class Sha1Context : IChecksum { readonly SHA1 _provider; diff --git a/SHA256Context.cs b/SHA256Context.cs index 2ed98f0..bc7d232 100644 --- a/SHA256Context.cs +++ b/SHA256Context.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Wraps up .NET SHA256 implementation to a Init(), Update(), Final() context. - public class Sha256Context : IChecksum + public sealed class Sha256Context : IChecksum { readonly SHA256 _provider; diff --git a/SHA384Context.cs b/SHA384Context.cs index db85bec..945720e 100644 --- a/SHA384Context.cs +++ b/SHA384Context.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Wraps up .NET SHA384 implementation to a Init(), Update(), Final() context. - public class Sha384Context : IChecksum + public sealed class Sha384Context : IChecksum { readonly SHA384 _provider; diff --git a/SHA512Context.cs b/SHA512Context.cs index 1c9f243..d0040d7 100644 --- a/SHA512Context.cs +++ b/SHA512Context.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Wraps up .NET SHA512 implementation to a Init(), Update(), Final() context. - public class Sha512Context : IChecksum + public sealed class Sha512Context : IChecksum { readonly SHA512 _provider; diff --git a/SpamSumContext.cs b/SpamSumContext.cs index a4ff46d..5e1c769 100644 --- a/SpamSumContext.cs +++ b/SpamSumContext.cs @@ -47,7 +47,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Checksums { /// Implements the SpamSum fuzzy hashing algorithm. - public class SpamSumContext : IChecksum + public sealed class SpamSumContext : IChecksum { const uint ROLLING_WINDOW = 7; const uint MIN_BLOCKSIZE = 3;