diff --git a/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs index 09cdfec..26f9cc5 100644 --- a/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs @@ -140,7 +140,7 @@ public void Argon2id_Implementation_HashSizeInBits_IsFromConfig() [Fact] public void Argon2id_Implementation_Verify_Works() { - Argon2id_Implementation impl = new Argon2id_Implementation(Argon2idConfig.OWASP_Standard); + Argon2id_Implementation impl = new Argon2id_Implementation(new Argon2idConfigProfileOWASP()); IHashValue hash1 = impl.ComputeHash(TestConstants.FooBar); Assert.NotNull(hash1); @@ -153,7 +153,7 @@ public void Argon2id_Implementation_Verify_Works() [Fact] public void Argon2id_Implementation_Verify_Irrelevant_Fails() { - Argon2id_Implementation impl = new Argon2id_Implementation(Argon2idConfig.OWASP_Standard); + Argon2id_Implementation impl = new Argon2id_Implementation(new Argon2idConfigProfileOWASP()); IHashValue hash1 = impl.ComputeHash(TestConstants.FooBar); Assert.NotNull(hash1); @@ -185,7 +185,7 @@ protected override IHashValue ComputeHash(IArgon2id hf, byte[] data) protected override IArgon2id CreateHashFunction(int hashSize) => new Argon2id_Implementation( - Argon2idConfig.OWASP_Standard); + new Argon2idConfigProfileOWASP()); } } } diff --git a/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs index b39b353..16e4c9e 100644 --- a/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs @@ -82,7 +82,7 @@ public void BuzHash_Implementation_Constructor_Config_IsCloned() var buzHashConfigMock = new Mock(); { buzHashConfigMock.Setup(bhc => bhc.Clone()) - .Returns(new DefaultBuzHashConfig()); + .Returns(new BuzHashConfigProfileDefault()); } GC.KeepAlive( @@ -402,7 +402,7 @@ public class IStreamableHashFunction_Tests protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { HashSizeInBits = hashSize }); @@ -420,7 +420,7 @@ public class IStreamableHashFunction_Tests_DefaultConstructor protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig()); + new BuzHashConfigProfileDefault()); } public class IStreamableHashFunction_Tests_RightShift @@ -444,7 +444,7 @@ public class IStreamableHashFunction_Tests_RightShift protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { HashSizeInBits = hashSize, ShiftDirection = CircularShiftDirection.Right @@ -463,7 +463,7 @@ public class IStreamableHashFunction_Tests_RightShift_DefaultConstructor protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { ShiftDirection = CircularShiftDirection.Right }); diff --git a/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs index 00bd85d..2145cbe 100644 --- a/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs @@ -36,7 +36,7 @@ public class DefaultBuzHashConfig_Tests [Fact] public void DefaultBuzHashConfig_Defaults_HaventChanged() { - var defaultBuzHashConfig = new DefaultBuzHashConfig(); + var defaultBuzHashConfig = new BuzHashConfigProfileDefault(); Assert.Equal(_expectedRtab.Select(u => unchecked((long)u)).ToArray(), defaultBuzHashConfig.Rtab); Assert.Equal(64, defaultBuzHashConfig.HashSizeInBits); @@ -47,7 +47,7 @@ public void DefaultBuzHashConfig_Defaults_HaventChanged() [Fact] public void DefaultBuzHashConfig_Clone_Works() { - var defaultBuzHashConfig = new DefaultBuzHashConfig() + var defaultBuzHashConfig = new BuzHashConfigProfileDefault() { HashSizeInBits = 32, Seed = 1337L, @@ -56,7 +56,7 @@ public void DefaultBuzHashConfig_Clone_Works() var defaultBuzHashConfigClone = defaultBuzHashConfig.Clone(); - Assert.IsType(defaultBuzHashConfig); + Assert.IsType(defaultBuzHashConfig); Assert.Equal(defaultBuzHashConfig.Rtab, defaultBuzHashConfigClone.Rtab); Assert.Equal(defaultBuzHashConfig.HashSizeInBits, defaultBuzHashConfigClone.HashSizeInBits); diff --git a/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs index 23237c5..975bf54 100644 --- a/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs @@ -67,7 +67,7 @@ public void CRCConfig_Standards_HaventChanged() [Fact] public void CRCConfig_Clone_Works() { - var crcConfig = CRCConfig.CRC64; + var crcConfig = new CRCConfigProfileCRC64(); var crcConfigClone = crcConfig.Clone(); @@ -84,7 +84,7 @@ public void CRCConfig_Clone_Works() private readonly IEnumerable, ICRCConfig>> _expectedCrcStandards = new[] { new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC3_ROHC, + () => new CRCConfigProfileCRC3_ROHC(), new CRCConfig { HashSizeInBits = 3, Polynomial = 0x3, @@ -95,7 +95,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC4_ITU, + () => new CRCConfigProfileCRC4_ITU(), new CRCConfig { HashSizeInBits = 4, Polynomial = 0x3, @@ -106,7 +106,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_EPC, + () => new CRCConfigProfileCRC5_EPC(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x09, @@ -117,7 +117,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_ITU, + () => new CRCConfigProfileCRC5_ITU(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x15, @@ -128,7 +128,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_USB, + () => new CRCConfigProfileCRC5_USB(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x05, @@ -139,7 +139,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_CDMA2000A, + () => new CRCConfigProfileCRC6_CDMA2000A(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x27, @@ -150,7 +150,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_CDMA2000B, + () => new CRCConfigProfileCRC6_CDMA2000B(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x07, @@ -161,7 +161,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_DARC, + () => new CRCConfigProfileCRC6_DARC(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x19, @@ -172,7 +172,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_ITU, + () => new CRCConfigProfileCRC6_ITU(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x03, @@ -183,7 +183,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC7, + () => new CRCConfigProfileCRC7(), new CRCConfig { HashSizeInBits = 7, Polynomial = 0x09, @@ -194,7 +194,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC7_ROHC, + () => new CRCConfigProfileCRC7_ROHC(), new CRCConfig { HashSizeInBits = 7, Polynomial = 0x4f, @@ -205,7 +205,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8, + () => new CRCConfigProfileCRC8(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -216,7 +216,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_CDMA2000, + () => new CRCConfigProfileCRC8_CDMA2000(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x9b, @@ -227,7 +227,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_DARC, + () => new CRCConfigProfileCRC8_DARC(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x39, @@ -238,7 +238,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_DVBS2, + () => new CRCConfigProfileCRC8_DVBS2(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0xd5, @@ -249,7 +249,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_EBU, + () => new CRCConfigProfileCRC8_EBU(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x1d, @@ -260,7 +260,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ICODE, + () => new CRCConfigProfileCRC8_ICODE(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x1d, @@ -271,7 +271,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ITU, + () => new CRCConfigProfileCRC8_ITU(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -282,7 +282,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_MAXIM, + () => new CRCConfigProfileCRC8_MAXIM(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x31, @@ -293,7 +293,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ROHC, + () => new CRCConfigProfileCRC8_ROHC(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -304,7 +304,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_WCDMA, + () => new CRCConfigProfileCRC8_WCDMA(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x9b, @@ -315,7 +315,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC10, + () => new CRCConfigProfileCRC10(), new CRCConfig { HashSizeInBits = 10, Polynomial = 0x233, @@ -326,7 +326,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC10_CDMA2000, + () => new CRCConfigProfileCRC10_CDMA2000(), new CRCConfig { HashSizeInBits = 10, Polynomial = 0x3d9, @@ -337,7 +337,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC11, + () => new CRCConfigProfileCRC11(), new CRCConfig { HashSizeInBits = 11, Polynomial = 0x385, @@ -348,7 +348,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_3GPP, + () => new CRCConfigProfileCRC12_3GPP(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0x80f, @@ -359,7 +359,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_CDMA2000, + () => new CRCConfigProfileCRC12_CDMA2000(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0xf13, @@ -370,7 +370,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_DECT, + () => new CRCConfigProfileCRC12_DECT(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0x80f, @@ -381,7 +381,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC13_BBC, + () => new CRCConfigProfileCRC13_BBC(), new CRCConfig { HashSizeInBits = 13, Polynomial = 0x1cf5, @@ -392,7 +392,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC14_DARC, + () => new CRCConfigProfileCRC14_DARC(), new CRCConfig { HashSizeInBits = 14, Polynomial = 0x0805, @@ -403,7 +403,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC15, + () => new CRCConfigProfileCRC15(), new CRCConfig { HashSizeInBits = 15, Polynomial = 0x4599, @@ -414,7 +414,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC15_MPT1327, + () => new CRCConfigProfileCRC15_MPT1327(), new CRCConfig { HashSizeInBits = 15, Polynomial = 0x6815, @@ -425,7 +425,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.ARC, + () => new CRCConfigProfileARC(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -436,7 +436,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_AUGCCITT, + () => new CRCConfigProfileCRC16_AUGCCITT(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -447,7 +447,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_BUYPASS, + () => new CRCConfigProfileCRC16_BUYPASS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -458,7 +458,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_CCITTFALSE, + () => new CRCConfigProfileCRC16_CCITTFALSE(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -469,7 +469,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_CDMA2000, + () => new CRCConfigProfileCRC16_CDMA2000(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0xc867, @@ -480,7 +480,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DDS110, + () => new CRCConfigProfileCRC16_DDS110(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -491,7 +491,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DECTR, + () => new CRCConfigProfileCRC16_DECTR(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x0589, @@ -502,7 +502,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DECTX, + () => new CRCConfigProfileCRC16_DECTX(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x0589, @@ -513,7 +513,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DNP, + () => new CRCConfigProfileCRC16_DNP(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x3d65, @@ -524,7 +524,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_EN13757, + () => new CRCConfigProfileCRC16_EN13757(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x3d65, @@ -535,7 +535,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_GENIBUS, + () => new CRCConfigProfileCRC16_GENIBUS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -546,7 +546,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_MAXIM, + () => new CRCConfigProfileCRC16_MAXIM(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -557,7 +557,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_MCRF4XX, + () => new CRCConfigProfileCRC16_MCRF4XX(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -568,7 +568,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_RIELLO, + () => new CRCConfigProfileCRC16_RIELLO(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -579,7 +579,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_T10DIF, + () => new CRCConfigProfileCRC16_T10DIF(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8bb7, @@ -590,7 +590,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_TELEDISK, + () => new CRCConfigProfileCRC16_TELEDISK(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0xa097, @@ -601,7 +601,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_TMS37157, + () => new CRCConfigProfileCRC16_TMS37157(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -612,7 +612,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_USB, + () => new CRCConfigProfileCRC16_USB(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -623,7 +623,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRCA, + () => new CRCConfigProfileCRCA(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -634,7 +634,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.KERMIT, + () => new CRCConfigProfileKERMIT(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -645,7 +645,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.MODBUS, + () => new CRCConfigProfileMODBUS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -656,7 +656,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.X25, + () => new CRCConfigProfileX25(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -667,7 +667,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.XMODEM, + () => new CRCConfigProfileXMODEM(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -678,7 +678,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24, + () => new CRCConfigProfileCRC24(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x864cfb, @@ -689,7 +689,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24_FLEXRAYA, + () => new CRCConfigProfileCRC24_FLEXRAYA(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x5d6dcb, @@ -700,7 +700,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24_FLEXRAYB, + () => new CRCConfigProfileCRC24_FLEXRAYB(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x5d6dcb, @@ -711,7 +711,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC31_PHILIPS, + () => new CRCConfigProfileCRC31_PHILIPS(), new CRCConfig { HashSizeInBits = 31, Polynomial = 0x04c11db7, @@ -722,7 +722,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32, + () => new CRCConfigProfileCRC32(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -733,7 +733,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_BZIP2, + () => new CRCConfigProfileCRC32_BZIP2(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -744,7 +744,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32C, + () => new CRCConfigProfileCRC32C(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x1edc6f41, @@ -755,7 +755,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32D, + () => new CRCConfigProfileCRC32D(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0xa833982b, @@ -766,7 +766,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_MPEG2, + () => new CRCConfigProfileCRC32_MPEG2(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -777,7 +777,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_POSIX, + () => new CRCConfigProfileCRC32_POSIX(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -788,7 +788,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32Q, + () => new CRCConfigProfileCRC32Q(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x814141ab, @@ -799,7 +799,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.JAMCRC, + () => new CRCConfigProfileJAMCRC(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -810,7 +810,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.XFER, + () => new CRCConfigProfileXFER(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x000000af, @@ -821,7 +821,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC40_GSM, + () => new CRCConfigProfileCRC40_GSM(), new CRCConfig { HashSizeInBits = 40, Polynomial = 0x0004820009, @@ -832,7 +832,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64, + () => new CRCConfigProfileCRC64(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, @@ -843,7 +843,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64_WE, + () => new CRCConfigProfileCRC64_WE(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, @@ -854,7 +854,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64_XZ, + () => new CRCConfigProfileCRC64_XZ(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, diff --git a/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs index eb32a45..68a532e 100644 --- a/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs @@ -197,7 +197,7 @@ public class IStreamableHashFunction_Tests_CRC3_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC3_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC3_ROHC()); } public class IStreamableHashFunction_Tests_CRC4_ITU @@ -209,7 +209,7 @@ public class IStreamableHashFunction_Tests_CRC4_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC4_ITU); + new CRC_Implementation(new CRCConfigProfileCRC4_ITU()); } public class IStreamableHashFunction_Tests_CRC5_EPC @@ -221,7 +221,7 @@ public class IStreamableHashFunction_Tests_CRC5_EPC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_EPC); + new CRC_Implementation(new CRCConfigProfileCRC5_EPC()); } public class IStreamableHashFunction_Tests_CRC5_ITU @@ -233,7 +233,7 @@ public class IStreamableHashFunction_Tests_CRC5_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_ITU); + new CRC_Implementation(new CRCConfigProfileCRC5_ITU()); } public class IStreamableHashFunction_Tests_CRC5_USB @@ -245,7 +245,7 @@ public class IStreamableHashFunction_Tests_CRC5_USB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_USB); + new CRC_Implementation(new CRCConfigProfileCRC5_USB()); } public class IStreamableHashFunction_Tests_CRC6_CDMA2000A @@ -257,7 +257,7 @@ public class IStreamableHashFunction_Tests_CRC6_CDMA2000A }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_CDMA2000A); + new CRC_Implementation(new CRCConfigProfileCRC6_CDMA2000A()); } public class IStreamableHashFunction_Tests_CRC6_CDMA2000B @@ -269,7 +269,7 @@ public class IStreamableHashFunction_Tests_CRC6_CDMA2000B }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_CDMA2000B); + new CRC_Implementation(new CRCConfigProfileCRC6_CDMA2000B()); } public class IStreamableHashFunction_Tests_CRC6_DARC @@ -281,7 +281,7 @@ public class IStreamableHashFunction_Tests_CRC6_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_DARC); + new CRC_Implementation(new CRCConfigProfileCRC6_DARC()); } public class IStreamableHashFunction_Tests_CRC6_ITU @@ -293,7 +293,7 @@ public class IStreamableHashFunction_Tests_CRC6_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_ITU); + new CRC_Implementation(new CRCConfigProfileCRC6_ITU()); } public class IStreamableHashFunction_Tests_CRC7 @@ -305,7 +305,7 @@ public class IStreamableHashFunction_Tests_CRC7 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC7); + new CRC_Implementation(new CRCConfigProfileCRC7()); } public class IStreamableHashFunction_Tests_CRC7_ROHC @@ -317,7 +317,7 @@ public class IStreamableHashFunction_Tests_CRC7_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC7_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC7_ROHC()); } public class IStreamableHashFunction_Tests_CRC8 @@ -329,7 +329,7 @@ public class IStreamableHashFunction_Tests_CRC8 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8); + new CRC_Implementation(new CRCConfigProfileCRC8()); } public class IStreamableHashFunction_Tests_CRC8_CDMA2000 @@ -341,7 +341,7 @@ public class IStreamableHashFunction_Tests_CRC8_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC8_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC8_DARC @@ -353,7 +353,7 @@ public class IStreamableHashFunction_Tests_CRC8_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_DARC); + new CRC_Implementation(new CRCConfigProfileCRC8_DARC()); } public class IStreamableHashFunction_Tests_CRC8_DVBS2 @@ -365,7 +365,7 @@ public class IStreamableHashFunction_Tests_CRC8_DVBS2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_DVBS2); + new CRC_Implementation(new CRCConfigProfileCRC8_DVBS2()); } public class IStreamableHashFunction_Tests_CRC8_EBU @@ -377,7 +377,7 @@ public class IStreamableHashFunction_Tests_CRC8_EBU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_EBU); + new CRC_Implementation(new CRCConfigProfileCRC8_EBU()); } public class IStreamableHashFunction_Tests_CRC8_ICODE @@ -389,7 +389,7 @@ public class IStreamableHashFunction_Tests_CRC8_ICODE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ICODE); + new CRC_Implementation(new CRCConfigProfileCRC8_ICODE()); } public class IStreamableHashFunction_Tests_CRC8_ITU @@ -401,7 +401,7 @@ public class IStreamableHashFunction_Tests_CRC8_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ITU); + new CRC_Implementation(new CRCConfigProfileCRC8_ITU()); } public class IStreamableHashFunction_Tests_CRC8_MAXIM @@ -413,7 +413,7 @@ public class IStreamableHashFunction_Tests_CRC8_MAXIM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_MAXIM); + new CRC_Implementation(new CRCConfigProfileCRC8_MAXIM()); } public class IStreamableHashFunction_Tests_CRC8_ROHC @@ -425,7 +425,7 @@ public class IStreamableHashFunction_Tests_CRC8_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC8_ROHC()); } public class IStreamableHashFunction_Tests_CRC8_WCDMA @@ -437,7 +437,7 @@ public class IStreamableHashFunction_Tests_CRC8_WCDMA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_WCDMA); + new CRC_Implementation(new CRCConfigProfileCRC8_WCDMA()); } public class IStreamableHashFunction_Tests_CRC10 @@ -449,7 +449,7 @@ public class IStreamableHashFunction_Tests_CRC10 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC10); + new CRC_Implementation(new CRCConfigProfileCRC10()); } public class IStreamableHashFunction_Tests_CRC10_CDMA2000 @@ -461,7 +461,7 @@ public class IStreamableHashFunction_Tests_CRC10_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC10_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC10_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC11 @@ -473,7 +473,7 @@ public class IStreamableHashFunction_Tests_CRC11 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC11); + new CRC_Implementation(new CRCConfigProfileCRC11()); } public class IStreamableHashFunction_Tests_CRC12_3GPP @@ -485,7 +485,7 @@ public class IStreamableHashFunction_Tests_CRC12_3GPP }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_3GPP); + new CRC_Implementation(new CRCConfigProfileCRC12_3GPP()); } public class IStreamableHashFunction_Tests_CRC12_CDMA2000 @@ -497,7 +497,7 @@ public class IStreamableHashFunction_Tests_CRC12_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC12_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC12_DECT @@ -509,7 +509,7 @@ public class IStreamableHashFunction_Tests_CRC12_DECT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_DECT); + new CRC_Implementation(new CRCConfigProfileCRC12_DECT()); } public class IStreamableHashFunction_Tests_CRC13_BBC @@ -521,7 +521,7 @@ public class IStreamableHashFunction_Tests_CRC13_BBC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC13_BBC); + new CRC_Implementation(new CRCConfigProfileCRC13_BBC()); } public class IStreamableHashFunction_Tests_CRC14_DARC @@ -533,7 +533,7 @@ public class IStreamableHashFunction_Tests_CRC14_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC14_DARC); + new CRC_Implementation(new CRCConfigProfileCRC14_DARC()); } public class IStreamableHashFunction_Tests_CRC15 @@ -545,7 +545,7 @@ public class IStreamableHashFunction_Tests_CRC15 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC15); + new CRC_Implementation(new CRCConfigProfileCRC15()); } public class IStreamableHashFunction_Tests_CRC15_MPT1327 @@ -557,7 +557,7 @@ public class IStreamableHashFunction_Tests_CRC15_MPT1327 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC15_MPT1327); + new CRC_Implementation(new CRCConfigProfileCRC15_MPT1327()); } public class IStreamableHashFunction_Tests_ARC @@ -569,7 +569,7 @@ public class IStreamableHashFunction_Tests_ARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.ARC); + new CRC_Implementation(new CRCConfigProfileARC()); } public class IStreamableHashFunction_Tests_CRC16_AUGCCITT @@ -581,7 +581,7 @@ public class IStreamableHashFunction_Tests_CRC16_AUGCCITT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_AUGCCITT); + new CRC_Implementation(new CRCConfigProfileCRC16_AUGCCITT()); } public class IStreamableHashFunction_Tests_CRC16_BUYPASS @@ -593,7 +593,7 @@ public class IStreamableHashFunction_Tests_CRC16_BUYPASS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_BUYPASS); + new CRC_Implementation(new CRCConfigProfileCRC16_BUYPASS()); } public class IStreamableHashFunction_Tests_CRC16_CCITTFALSE @@ -605,7 +605,7 @@ public class IStreamableHashFunction_Tests_CRC16_CCITTFALSE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_CCITTFALSE); + new CRC_Implementation(new CRCConfigProfileCRC16_CCITTFALSE()); } public class IStreamableHashFunction_Tests_CRC16_CDMA2000 @@ -617,7 +617,7 @@ public class IStreamableHashFunction_Tests_CRC16_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC16_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC16_DDS110 @@ -629,7 +629,7 @@ public class IStreamableHashFunction_Tests_CRC16_DDS110 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DDS110); + new CRC_Implementation(new CRCConfigProfileCRC16_DDS110()); } public class IStreamableHashFunction_Tests_CRC16_DECTR @@ -641,7 +641,7 @@ public class IStreamableHashFunction_Tests_CRC16_DECTR }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DECTR); + new CRC_Implementation(new CRCConfigProfileCRC16_DECTR()); } public class IStreamableHashFunction_Tests_CRC16_DECTX @@ -653,7 +653,7 @@ public class IStreamableHashFunction_Tests_CRC16_DECTX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DECTX); + new CRC_Implementation(new CRCConfigProfileCRC16_DECTX()); } public class IStreamableHashFunction_Tests_CRC16_DNP @@ -665,7 +665,7 @@ public class IStreamableHashFunction_Tests_CRC16_DNP }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DNP); + new CRC_Implementation(new CRCConfigProfileCRC16_DNP()); } public class IStreamableHashFunction_Tests_CRC16_EN13757 @@ -677,7 +677,7 @@ public class IStreamableHashFunction_Tests_CRC16_EN13757 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_EN13757); + new CRC_Implementation(new CRCConfigProfileCRC16_EN13757()); } public class IStreamableHashFunction_Tests_CRC16_GENIBUS @@ -689,7 +689,7 @@ public class IStreamableHashFunction_Tests_CRC16_GENIBUS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_GENIBUS); + new CRC_Implementation(new CRCConfigProfileCRC16_GENIBUS()); } public class IStreamableHashFunction_Tests_CRC16_MAXIM @@ -701,7 +701,7 @@ public class IStreamableHashFunction_Tests_CRC16_MAXIM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_MAXIM); + new CRC_Implementation(new CRCConfigProfileCRC16_MAXIM()); } public class IStreamableHashFunction_Tests_CRC16_MCRF4XX @@ -713,7 +713,7 @@ public class IStreamableHashFunction_Tests_CRC16_MCRF4XX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_MCRF4XX); + new CRC_Implementation(new CRCConfigProfileCRC16_MCRF4XX()); } public class IStreamableHashFunction_Tests_CRC16_RIELLO @@ -725,7 +725,7 @@ public class IStreamableHashFunction_Tests_CRC16_RIELLO }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_RIELLO); + new CRC_Implementation(new CRCConfigProfileCRC16_RIELLO()); } public class IStreamableHashFunction_Tests_CRC16_T10DIF @@ -737,7 +737,7 @@ public class IStreamableHashFunction_Tests_CRC16_T10DIF }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_T10DIF); + new CRC_Implementation(new CRCConfigProfileCRC16_T10DIF()); } public class IStreamableHashFunction_Tests_CRC16_TELEDISK @@ -749,7 +749,7 @@ public class IStreamableHashFunction_Tests_CRC16_TELEDISK }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_TELEDISK); + new CRC_Implementation(new CRCConfigProfileCRC16_TELEDISK()); } public class IStreamableHashFunction_Tests_CRC16_TMS37157 @@ -761,7 +761,7 @@ public class IStreamableHashFunction_Tests_CRC16_TMS37157 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_TMS37157); + new CRC_Implementation(new CRCConfigProfileCRC16_TMS37157()); } public class IStreamableHashFunction_Tests_CRC16_USB @@ -773,7 +773,7 @@ public class IStreamableHashFunction_Tests_CRC16_USB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_USB); + new CRC_Implementation(new CRCConfigProfileCRC16_USB()); } public class IStreamableHashFunction_Tests_CRCA @@ -785,7 +785,7 @@ public class IStreamableHashFunction_Tests_CRCA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRCA); + new CRC_Implementation(new CRCConfigProfileCRCA()); } public class IStreamableHashFunction_Tests_KERMIT @@ -797,7 +797,7 @@ public class IStreamableHashFunction_Tests_KERMIT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.KERMIT); + new CRC_Implementation(new CRCConfigProfileKERMIT()); } public class IStreamableHashFunction_Tests_MODBUS @@ -809,7 +809,7 @@ public class IStreamableHashFunction_Tests_MODBUS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.MODBUS); + new CRC_Implementation(new CRCConfigProfileMODBUS()); } public class IStreamableHashFunction_Tests_X25 @@ -821,7 +821,7 @@ public class IStreamableHashFunction_Tests_X25 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.X25); + new CRC_Implementation(new CRCConfigProfileX25()); } public class IStreamableHashFunction_Tests_XMODEM @@ -833,7 +833,7 @@ public class IStreamableHashFunction_Tests_XMODEM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.XMODEM); + new CRC_Implementation(new CRCConfigProfileXMODEM()); } public class IStreamableHashFunction_Tests_CRC24 @@ -845,7 +845,7 @@ public class IStreamableHashFunction_Tests_CRC24 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24); + new CRC_Implementation(new CRCConfigProfileCRC24()); } public class IStreamableHashFunction_Tests_CRC24_FLEXRAYA @@ -857,7 +857,7 @@ public class IStreamableHashFunction_Tests_CRC24_FLEXRAYA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24_FLEXRAYA); + new CRC_Implementation(new CRCConfigProfileCRC24_FLEXRAYA()); } public class IStreamableHashFunction_Tests_CRC24_FLEXRAYB @@ -869,7 +869,7 @@ public class IStreamableHashFunction_Tests_CRC24_FLEXRAYB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24_FLEXRAYB); + new CRC_Implementation(new CRCConfigProfileCRC24_FLEXRAYB()); } public class IStreamableHashFunction_Tests_CRC31_PHILIPS @@ -881,7 +881,7 @@ public class IStreamableHashFunction_Tests_CRC31_PHILIPS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC31_PHILIPS); + new CRC_Implementation(new CRCConfigProfileCRC31_PHILIPS()); } public class IStreamableHashFunction_Tests_CRC32 @@ -893,7 +893,7 @@ public class IStreamableHashFunction_Tests_CRC32 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32); + new CRC_Implementation(new CRCConfigProfileCRC32()); } public class IStreamableHashFunction_Tests_CRC32_BZIP2 @@ -905,7 +905,7 @@ public class IStreamableHashFunction_Tests_CRC32_BZIP2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_BZIP2); + new CRC_Implementation(new CRCConfigProfileCRC32_BZIP2()); } public class IStreamableHashFunction_Tests_CRC32C @@ -917,7 +917,7 @@ public class IStreamableHashFunction_Tests_CRC32C }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32C); + new CRC_Implementation(new CRCConfigProfileCRC32C()); } public class IStreamableHashFunction_Tests_CRC32D @@ -929,7 +929,7 @@ public class IStreamableHashFunction_Tests_CRC32D }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32D); + new CRC_Implementation(new CRCConfigProfileCRC32D()); } public class IStreamableHashFunction_Tests_CRC32_MPEG2 @@ -941,7 +941,7 @@ public class IStreamableHashFunction_Tests_CRC32_MPEG2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_MPEG2); + new CRC_Implementation(new CRCConfigProfileCRC32_MPEG2()); } public class IStreamableHashFunction_Tests_CRC32_POSIX @@ -953,7 +953,7 @@ public class IStreamableHashFunction_Tests_CRC32_POSIX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_POSIX); + new CRC_Implementation(new CRCConfigProfileCRC32_POSIX()); } public class IStreamableHashFunction_Tests_CRC32Q @@ -965,7 +965,7 @@ public class IStreamableHashFunction_Tests_CRC32Q }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32Q); + new CRC_Implementation(new CRCConfigProfileCRC32Q()); } public class IStreamableHashFunction_Tests_JAMCRC @@ -977,7 +977,7 @@ public class IStreamableHashFunction_Tests_JAMCRC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.JAMCRC); + new CRC_Implementation(new CRCConfigProfileJAMCRC()); } public class IStreamableHashFunction_Tests_XFER @@ -989,7 +989,7 @@ public class IStreamableHashFunction_Tests_XFER }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.XFER); + new CRC_Implementation(new CRCConfigProfileXFER()); } public class IStreamableHashFunction_Tests_CRC40_GSM @@ -1001,7 +1001,7 @@ public class IStreamableHashFunction_Tests_CRC40_GSM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC40_GSM); + new CRC_Implementation(new CRCConfigProfileCRC40_GSM()); } public class IStreamableHashFunction_Tests_CRC64 @@ -1013,7 +1013,7 @@ public class IStreamableHashFunction_Tests_CRC64 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64); + new CRC_Implementation(new CRCConfigProfileCRC64()); } public class IStreamableHashFunction_Tests_CRC64_WE @@ -1025,7 +1025,7 @@ public class IStreamableHashFunction_Tests_CRC64_WE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64_WE); + new CRC_Implementation(new CRCConfigProfileCRC64_WE()); } public class IStreamableHashFunction_Tests_CRC64_XZ @@ -1037,7 +1037,7 @@ public class IStreamableHashFunction_Tests_CRC64_XZ }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64_XZ); + new CRC_Implementation(new CRCConfigProfileCRC64_XZ()); } } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs index e3289fb..d08b4f5 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs @@ -41,21 +41,20 @@ private FNV1Impl(IFNVConfig config) { } - public static UInt32[] _ExtendedMultiply(IReadOnlyList operand1, IReadOnlyList operand2, int hashSizeInBytes) => + public static uint[] ExtendedMultiplyTest(IReadOnlyList operand1, IReadOnlyList operand2, int hashSizeInBytes) => ExtendedMultiply(operand1, operand2, hashSizeInBytes); - } [Fact] public void FNV1Base_ExtendedMultiply_WorksConversly() { - var x = new UInt32[] { 65536, 1024 }; - var y = new UInt32[] { 524288, 65536, 1024, 8 }; + var x = new uint[] { 65536, 1024 }; + var y = new uint[] { 524288, 65536, 1024, 8 }; - var expectedValue = new UInt32[] { 0, 536870920, 134217729, 1572864 }; + var expectedValue = new uint[] { 0, 536870920, 134217729, 1572864 }; - Assert.Equal(expectedValue, FNV1Impl._ExtendedMultiply(x, y, 16)); - Assert.Equal(expectedValue, FNV1Impl._ExtendedMultiply(y, x, 16)); + Assert.Equal(expectedValue, FNV1Impl.ExtendedMultiplyTest(x, y, 16)); + Assert.Equal(expectedValue, FNV1Impl.ExtendedMultiplyTest(y, x, 16)); } } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs index 80cecda..2d0e2a3 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using HashifyNet.UnitTests.Utilities; using Moq; using System.Numerics; @@ -350,7 +351,7 @@ public class IStreamableHashFunction_Tests protected override IFNV1 CreateHashFunction(int hashSize) => new FNV1_Implementation( - FNVConfig.GetPredefinedConfig(hashSize)); + ConfigProfileHelper.GetProfile(hashSize)); } } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs index 985735b..9d031f1 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using HashifyNet.UnitTests.Utilities; using Moq; using System.Numerics; @@ -351,7 +352,7 @@ public class IStreamableHashFunction_Tests protected override IFNV1a CreateHashFunction(int hashSize) => new FNV1a_Implementation( - FNVConfig.GetPredefinedConfig(hashSize)); + ConfigProfileHelper.GetProfile(hashSize)); } } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs index 3ac56f2..7c8ae11 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using System.Numerics; namespace HashifyNet.UnitTests.Algorithms.FNV @@ -74,7 +75,7 @@ public void FNVConfig_GetPredefinedConfig_InvalidSizes_Throw() Assert.Equal( "hashSizeInBits", Assert.Throws( - () => FNVConfig.GetPredefinedConfig(invalidHashSize)) + () => ConfigProfileHelper.GetProfile(invalidHashSize)) .ParamName); } } @@ -84,7 +85,7 @@ public void FNVConfig_GetPredefinedConfig_ExpectedValues_Work() { foreach (var expectedPredefinedConfig in _expectedPredefinedConfigs) { - var fnvConfig = FNVConfig.GetPredefinedConfig(expectedPredefinedConfig.HashSizeInBits); + var fnvConfig = ConfigProfileHelper.GetProfile(expectedPredefinedConfig.HashSizeInBits); Assert.Equal(expectedPredefinedConfig.HashSizeInBits, fnvConfig.HashSizeInBits); Assert.Equal(expectedPredefinedConfig.Prime, fnvConfig.Prime); @@ -127,4 +128,4 @@ public void FNVConfig_GetPredefinedConfig_ExpectedValues_Work() } }; } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs b/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs new file mode 100644 index 0000000..a0b3e43 --- /dev/null +++ b/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs @@ -0,0 +1,57 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Algorithms.FNV; + +namespace HashifyNet.UnitTests.Algorithms.FNV.Utilities +{ + internal static class ConfigProfileHelper + { + public static IFNVConfig GetProfile(int hashSizeInBits) + { + switch (hashSizeInBits) + { + case 32: + return new FNVConfigProfile32Bits(); + case 64: + return new FNVConfigProfile64Bits(); + case 128: + return new FNVConfigProfile128Bits(); + case 256: + return new FNVConfigProfile256Bits(); + case 512: + return new FNVConfigProfile512Bits(); + case 1024: + return new FNVConfigProfile1024Bits(); + default: + throw new ArgumentOutOfRangeException(nameof(hashSizeInBits), "Only 32, 64, 128, 256, 512, and 1024 are valid hash sizes for FNV."); + } + } + } +} diff --git a/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs index 940b146..de7a6bb 100644 --- a/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs @@ -78,7 +78,7 @@ public void Pearson_Implementation_Constructor_Config_IsCloned() var pearsonConfigMock = new Mock(); { pearsonConfigMock.Setup(pc => pc.Clone()) - .Returns(() => new WikipediaPearsonConfig() + .Returns(() => new PearsonConfigProfileWikipedia() { HashSizeInBits = 8 }); @@ -288,7 +288,7 @@ public class IStreamableHashFunction_Tests_WikipediaPearson protected override IPearson CreateHashFunction(int hashSize) => new Pearson_Implementation( - new WikipediaPearsonConfig() + new PearsonConfigProfileWikipedia() { HashSizeInBits = hashSize }); @@ -306,7 +306,7 @@ public class IStreamableHashFunction_Tests_WikipediaPearson_DefaultConstructor protected override IPearson CreateHashFunction(int hashSize) => new Pearson_Implementation( - new WikipediaPearsonConfig()); + new PearsonConfigProfileWikipedia()); } } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs index 0ccae94..4c04812 100644 --- a/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs @@ -36,7 +36,7 @@ public class WikipediaPearsonConfig_Tests [Fact] public void WikipediaPearsonConfig_Defaults_HaventChanged() { - var wikipediaPearsonConfig = new WikipediaPearsonConfig(); + var wikipediaPearsonConfig = new PearsonConfigProfileWikipedia(); Assert.Equal(_expectedTable, wikipediaPearsonConfig.Table); Assert.Equal(8, wikipediaPearsonConfig.HashSizeInBits); @@ -45,14 +45,14 @@ public void WikipediaPearsonConfig_Defaults_HaventChanged() [Fact] public void WikipediaPearsonConfig_Clone_Works() { - var wikipediaPearsonConfig = new WikipediaPearsonConfig() + var wikipediaPearsonConfig = new PearsonConfigProfileWikipedia() { HashSizeInBits = 16 }; var wikipediaPearsonConfigClone = wikipediaPearsonConfig.Clone(); - Assert.IsType(wikipediaPearsonConfigClone); + Assert.IsType(wikipediaPearsonConfigClone); Assert.Equal(wikipediaPearsonConfig.Table, wikipediaPearsonConfigClone.Table); Assert.Equal(wikipediaPearsonConfig.HashSizeInBits, wikipediaPearsonConfigClone.HashSizeInBits); @@ -78,4 +78,4 @@ public void WikipediaPearsonConfig_Clone_Works() 43, 119, 224, 71, 122, 142, 42, 160, 104, 48, 247, 103, 15, 11, 138, 239 // 16 }; } -} \ No newline at end of file +} diff --git a/HashifyNet.UnitTests/Core/FactoryTests.cs b/HashifyNet.UnitTests/Core/FactoryTests.cs index 82ff892..441cd3f 100644 --- a/HashifyNet.UnitTests/Core/FactoryTests.cs +++ b/HashifyNet.UnitTests/Core/FactoryTests.cs @@ -32,7 +32,6 @@ using HashifyNet.Algorithms.CRC; using HashifyNet.Algorithms.FNV; using HashifyNet.Algorithms.Pearson; -using HashifyNet.Core.HashAlgorithm; using HashifyNet.UnitTests.Utilities; namespace HashifyNet.UnitTests.Core @@ -42,7 +41,7 @@ public class FactoryTests [Fact] public void Factory_CreateInstance_ValidInputs_Works() { - var instance = HashFactory.Create(CRCConfig.CRC32); + var instance = HashFactory.Create(new CRCConfigProfileCRC32()); Assert.NotNull(instance); Assert.IsType(instance); } @@ -95,11 +94,11 @@ public void Factory_ComputeNonCryptographicHashes_Works() { IHashFunctionBase[] functions = HashFactory.CreateHashAlgorithms(HashFunctionType.Noncryptographic, new Dictionary() { - { typeof(ICRC), CRCConfig.CRC32 }, - { typeof(IPearson), new WikipediaPearsonConfig() }, - { typeof(IFNV1), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IFNV1a), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IBuzHash), new DefaultBuzHashConfig() }, + { typeof(ICRC), new CRCConfigProfileCRC32() }, + { typeof(IPearson), new PearsonConfigProfileWikipedia() }, + { typeof(IFNV1), new FNVConfigProfile32Bits() }, + { typeof(IFNV1a), new FNVConfigProfile32Bits() }, + { typeof(IBuzHash), new BuzHashConfigProfileDefault() }, }); Assert.NotNull(functions); @@ -119,7 +118,7 @@ public void Factory_ComputeCryptographicHashes_Works() { IHashFunctionBase[] functions = HashFactory.CreateHashAlgorithms(HashFunctionType.Cryptographic, new Dictionary() { - { typeof(IArgon2id), Argon2idConfig.OWASP_Standard } + { typeof(IArgon2id), new Argon2idConfigProfileOWASP() } }, HashFactory.GetUnavailableHashAlgorithms()); Assert.NotNull(functions); @@ -142,7 +141,7 @@ public void Factory_GetWithType_Works() Type type = typeof(ICRC); Assert.NotNull(type); - var instance = HashFactory.Create(type, CRCConfig.CRC32); + var instance = HashFactory.Create(type, new CRCConfigProfileCRC32()); Assert.NotNull(instance); Assert.IsType(instance); } @@ -150,15 +149,17 @@ public void Factory_GetWithType_Works() [Fact] public void Factory_CreateInstance_WithConfig_Works() { - ICRC crc = HashFactory.Create(CRCConfig.CRC7); + ICRC crc = HashFactory.Create(new CRCConfigProfileCRC7()); Assert.NotNull(crc); Assert.IsType(crc); - Assert.Equal(CRCConfig.CRC7.HashSizeInBits, crc.Config.HashSizeInBits); - Assert.Equal(CRCConfig.CRC7.InitialValue, crc.Config.InitialValue); - Assert.Equal(CRCConfig.CRC7.Polynomial, crc.Config.Polynomial); - Assert.Equal(CRCConfig.CRC7.ReflectIn, crc.Config.ReflectIn); - Assert.Equal(CRCConfig.CRC7.ReflectOut, crc.Config.ReflectOut); - Assert.Equal(CRCConfig.CRC7.XOrOut, crc.Config.XOrOut); + + ICRCConfig crc7 = new CRCConfigProfileCRC7(); + Assert.Equal(crc7.HashSizeInBits, crc.Config.HashSizeInBits); + Assert.Equal(crc7.InitialValue, crc.Config.InitialValue); + Assert.Equal(crc7.Polynomial, crc.Config.Polynomial); + Assert.Equal(crc7.ReflectIn, crc.Config.ReflectIn); + Assert.Equal(crc7.ReflectOut, crc.Config.ReflectOut); + Assert.Equal(crc7.XOrOut, crc.Config.XOrOut); } [Fact] @@ -192,5 +193,69 @@ public void Factory_TryCreateDefaultConcreteConfig_NeverThrows() { HashFactory.TryCreateDefaultConcreteConfig(typeof(ICRC), out _); } + + [Fact] + public void Factory_GetConfigProfiles_Works() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + + List allProfiles = new(); + foreach (var algorithm in algorithms) + { + allProfiles.AddRange(HashFactory.GetConfigProfiles(algorithm)); + } + + Assert.NotEmpty(allProfiles); + Assert.All(allProfiles, item => Assert.NotNull(item)); + Assert.All(allProfiles, item => Assert.False(string.IsNullOrWhiteSpace(item.Name))); + } + + [Fact] + public void Factory_GetConfigProfiles_Null_Throws() + { + Assert.Throws(() => + { + HashFactory.GetConfigProfiles(null); + }); + } + + [Fact] + public void Factory_GetConfigProfiles_NoProfiles_Works() + { + var profiles = HashFactory.GetConfigProfiles(typeof(string)); + Assert.NotNull(profiles); + Assert.Empty(profiles); + } + + [Fact] + public void Factory_GetConfigProfiles_HasUniqueNames() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + foreach (var algorithm in algorithms) + { + var profiles = HashFactory.GetConfigProfiles(algorithm); + var names = new HashSet(StringComparer.OrdinalIgnoreCase); + foreach (var profile in profiles) + { + Assert.True(names.Add(profile.Name), $"Duplicate profile name '{profile.Name}' found for algorithm '{algorithm.FullName}'."); + } + } + } + + [Fact] + public void Factory_GetConfigProfiles_Create_Works() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + foreach (var algorithm in algorithms) + { + var profiles = HashFactory.GetConfigProfiles(algorithm); + foreach (var profile in profiles) + { + IHashConfigBase config = profile.Create(); + Assert.NotNull(config); + Assert.IsType(profile.ProfileType, config); + } + } + } } } diff --git a/HashifyNet.UnitTests/Core/UniversalTest.cs b/HashifyNet.UnitTests/Core/UniversalTest.cs index cbce14d..dc01478 100644 --- a/HashifyNet.UnitTests/Core/UniversalTest.cs +++ b/HashifyNet.UnitTests/Core/UniversalTest.cs @@ -580,14 +580,14 @@ public void RunUniversalTest() IHashFunctionBase[] all = HashFactory.CreateHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic, new Dictionary() { // Non-cryptographic Forced Defaults - { typeof(ICRC), CRCConfig.CRC32 }, - { typeof(IPearson), new WikipediaPearsonConfig() }, - { typeof(IFNV1), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IFNV1a), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IBuzHash), new DefaultBuzHashConfig() }, + { typeof(ICRC), new CRCConfigProfileCRC32() }, + { typeof(IPearson), new PearsonConfigProfileWikipedia() }, + { typeof(IFNV1), new FNVConfigProfile32Bits() }, + { typeof(IFNV1a), new FNVConfigProfile32Bits() }, + { typeof(IBuzHash), new BuzHashConfigProfileDefault() }, // Cryptographic Forced Defaults - { typeof(IArgon2id), Argon2idConfig.OWASP_Standard } + { typeof(IArgon2id), new Argon2idConfigProfileOWASP() } }, HashFactory.GetUnavailableHashAlgorithms()); Assert.NotNull(all); @@ -699,3 +699,4 @@ public void RunUniversalTest() } + diff --git a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs index 6380dee..0ae3fac 100644 --- a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs +++ b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -27,6 +27,7 @@ // ****************************************************************************** // * +using HashifyNet.Core; using HashifyNet.Core.Utilities; namespace HashifyNet.Algorithms.Argon2id @@ -37,38 +38,11 @@ namespace HashifyNet.Algorithms.Argon2id /// This class provides properties to configure the behavior of the Argon2id algorithm, including /// memory usage, iteration count, and parallelism. It also includes predefined configurations recommended by OWASP and /// IETF RFC 9106 for various use cases, such as memory-constrained or high-memory systems. + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileOWASP))] + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileIETFLowMemory))] + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileIETFHighMemory))] public class Argon2idConfig : IArgon2idConfig { - /// - /// A secure baseline recommended by OWASP. - /// - public static IArgon2idConfig OWASP_Standard => new Argon2idConfig() - { - MemorySize = 19456, // 19 MiB - Iterations = 2, - DegreeOfParallelism = 1, - }.Clone(); - - /// - /// A strong recommendation from IETF RFC 9106 for memory-constrained systems. - /// - public static IArgon2idConfig IETF_LowMemory => new Argon2idConfig() - { - MemorySize = 65536, // 64 MiB - Iterations = 3, - DegreeOfParallelism = 4, - }.Clone(); - - /// - /// A very strong recommendation from IETF RFC 9106 for systems with ample memory. - /// - public static IArgon2idConfig IETF_HighMemory => new Argon2idConfig() - { - MemorySize = 2097152, // 2 GiB - Iterations = 1, - DegreeOfParallelism = 4, - }.Clone(); - /// /// /// diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs new file mode 100644 index 0000000..f25d7e8 --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs @@ -0,0 +1,64 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory + /// usage in compliance with IETF recommendations. + /// + /// This configuration is tailored for scenarios where high memory availability is prioritized to + /// enhance resistance against memory-hard attacks. The default settings are: + /// : 2 GiB (2097152 KiB) : 1 : + /// 4 These values are suitable for environments requiring strong security guarantees and + /// where memory resources are not constrained. + [DefineHashConfigProfile("IETF/HighMemory", "Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory usage in compliance with IETF recommendations.")] + public sealed class Argon2idConfigProfileIETFHighMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for high memory usage. + /// + /// This configuration is designed to comply with the IETF Argon2id recommendations for high memory + /// usage scenarios. The default values are: : 2 GiB + /// (2097152 KiB) : 1 + /// : 4 These defaults are suitable + /// for environments where memory availability is high and security requirements prioritize resistance to memory-hard + /// attacks. + public Argon2idConfigProfileIETFHighMemory() + { + MemorySize = 2097152; // 2 GiB + Iterations = 1; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs new file mode 100644 index 0000000..053891a --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF + /// recommended settings. + /// + /// This configuration is designed for scenarios where memory usage is constrained, while still + /// maintaining a balance between security and performance. It sets the memory size to 64 MiB, the number of iterations + /// to 3, and the degree of parallelism to 4. + [DefineHashConfigProfile("IETF/LowMemory", "Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF recommended settings.")] + public sealed class Argon2idConfigProfileIETFLowMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for low memory usage. + /// + /// This constructor sets the following default values: : 64 MiB (65536 KiB) : + /// 3 : 4 These + /// defaults are suitable for environments with constrained memory resources while maintaining reasonable security and + /// performance. + public Argon2idConfigProfileIETFLowMemory() + { + MemorySize = 65536; // 64 MiB + Iterations = 3; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs new file mode 100644 index 0000000..e55a85f --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, + /// iterations, and parallelism. + /// + /// This configuration is designed to balance security and performance based on OWASP guidelines. It + /// sets the memory size to 19 MiB, the number of iterations to 2, and the degree of parallelism to 1. These values are + /// suitable for most general-purpose applications but may need adjustment for specific use cases or + /// environments. + [DefineHashConfigProfile("OWASP", "Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, iterations, and parallelism.")] + public sealed class Argon2idConfigProfileOWASP : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration values + /// recommended by the OWASP Password Storage Cheat Sheet. + /// + /// The default configuration values are: : 19 MiB (19456 KiB). : + /// 2. : 1. + /// These values are suitable for environments with limited resources while maintaining reasonable security. + public Argon2idConfigProfileOWASP() + { + MemorySize = 19456; // 19 MiB + Iterations = 2; + DegreeOfParallelism = 1; + } + } +} diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs index e2334a7..d862a84 100644 --- a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs @@ -27,7 +27,7 @@ // ****************************************************************************** // * -using System; +using HashifyNet.Core; using System.Collections.Generic; using System.Linq; @@ -36,6 +36,7 @@ namespace HashifyNet.Algorithms.BuzHash /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(BuzHashConfigProfileDefault))] public class BuzHashConfig : IBuzHashConfig { @@ -65,7 +66,7 @@ public class BuzHashConfig /// The seed value. /// /// - /// Defaults to 0 + /// Defaults to 0L /// public long Seed { get; set; } diff --git a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs similarity index 80% rename from HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs rename to HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs index a13192f..56000f3 100644 --- a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs @@ -27,60 +27,33 @@ // ****************************************************************************** // * -using System.Linq; +using HashifyNet.Core; using System.Collections.Generic; +using System.Linq; namespace HashifyNet.Algorithms.BuzHash { /// /// Defines a default configuration for a implementation. /// - public class DefaultBuzHashConfig - : IBuzHashConfig + [DefineHashConfigProfile("Default", "Default configuration for Buz Hash.")] + public sealed class BuzHashConfigProfileDefault + : BuzHashConfig { /// - /// Gets a list of 256 (preferably random and distinct) values. - /// - /// - /// List of 256 values. - /// - /// - /// Defaults to a statically defined, random chosen of values. - /// - public IReadOnlyList Rtab { get; } = _Rtab.Select(u => unchecked((long)u)).ToArray(); - - /// - /// Gets the desired hash size, in bits. - /// - /// - /// The desired hash size, in bits. - /// - /// - /// Defaults to 64. - /// - public int HashSizeInBits { get; set; } = 64; - - /// - /// Gets the seed value. + /// Initializes a new instance of the class with default configuration + /// values. /// - /// - /// The seed value. - /// - /// - /// Defaults to 0x3CD05367FD0337D3UL - /// - public long Seed { get; set; } = 0x3CD05367FD0337D3L; - - /// - /// Gets the shift direction. - /// - /// - /// The shift direction. - /// - /// - /// Defaults to . - /// - public CircularShiftDirection ShiftDirection { get; set; } = CircularShiftDirection.Left; + /// This constructor sets up the default configuration for a BuzHash profile, including the hash + /// size, seed value, and circular shift direction. The default values are suitable for general-purpose hashing + /// scenarios. + public BuzHashConfigProfileDefault() + { + Rtab = _Rtab.Select(u => unchecked((long)u)).ToArray(); + HashSizeInBits = 64; + Seed = 0x3CD05367FD0337D3L; + ShiftDirection = CircularShiftDirection.Left; + } private static readonly IReadOnlyList _Rtab = new ulong[] { @@ -149,17 +122,5 @@ public class DefaultBuzHashConfig 0xDD645E45898E166D, 0x80000D38B28D2BC0, 0xF7ADA101A6F34F0F, 0x04404000A27DB2F2, 0x7B79E1EC83874C2A, 0x6B2FFD2662DA5E68, 0xCF3EEBA20B383BCE, 0x4503C00A838F9989 }; - - /// - /// Makes a deep clone of the current instance. - /// - /// A deep clone of the current instance. - public IBuzHashConfig Clone() => - new DefaultBuzHashConfig() - { - HashSizeInBits = HashSizeInBits, - Seed = Seed, - ShiftDirection = ShiftDirection - }; } } diff --git a/HashifyNet/Algorithms/CRC/CRCConfig.cs b/HashifyNet/Algorithms/CRC/CRCConfig.cs index d7a848e..a4b4d79 100644 --- a/HashifyNet/Algorithms/CRC/CRCConfig.cs +++ b/HashifyNet/Algorithms/CRC/CRCConfig.cs @@ -27,13 +27,84 @@ // ****************************************************************************** // * -using System; +using HashifyNet.Core; namespace HashifyNet.Algorithms.CRC { /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC3_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC4_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_EPC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_USB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_CDMA2000A))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_CDMA2000B))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC7))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC7_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_DVBS2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_EBU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ICODE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_MAXIM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_WCDMA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC10))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC10_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC11))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_3GPP))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_DECT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC13_BBC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC14_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC15))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC15_MPT1327))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_AUGCCITT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_BUYPASS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_CCITTFALSE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DDS110))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DECTR))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DECTX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DNP))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_EN13757))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_GENIBUS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_MAXIM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_MCRF4XX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_RIELLO))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_T10DIF))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_TELEDISK))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_TMS37157))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_USB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRCA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileKERMIT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileMODBUS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileX25))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileXMODEM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24_FLEXRAYA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24_FLEXRAYB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC31_PHILIPS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_BZIP2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32C))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32D))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_MPEG2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_POSIX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32Q))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileJAMCRC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileXFER))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC40_GSM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64_WE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64_XZ))] public class CRCConfig : ICRCConfig { @@ -85,1290 +156,8 @@ public class CRCConfig /// public long XOrOut { get; set; } - #region Standards - - /// - /// Creates an instance of configured to the CRC3_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC3_ROHC => new CRCConfig() - { - HashSizeInBits = 3, - Polynomial = 0x3, - InitialValue = 0x7, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC4_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC4_ITU => new CRCConfig() - { - HashSizeInBits = 4, - Polynomial = 0x3, - InitialValue = 0x0, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_EPC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_EPC => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x09, - InitialValue = 0x09, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_ITU => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x15, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_USB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_USB => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x05, - InitialValue = 0x1f, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x1f, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_CDMA2000A standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_CDMA2000A => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x27, - InitialValue = 0x3f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_CDMA2000B standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_CDMA2000B => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x07, - InitialValue = 0x3f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_DARC => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x19, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_ITU => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x03, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC7 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC7 => new CRCConfig() - { - HashSizeInBits = 7, - Polynomial = 0x09, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC7_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC7_ROHC => new CRCConfig() - { - HashSizeInBits = 7, - Polynomial = 0x4f, - InitialValue = 0x7f, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x9b, - InitialValue = 0xff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_DARC => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x39, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_DVBS2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_DVBS2 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0xd5, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_EBU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_EBU => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x1d, - InitialValue = 0xff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ICODE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ICODE => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x1d, - InitialValue = 0xfd, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ITU => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x55, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_MAXIM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_MAXIM => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x31, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ROHC => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0xff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_WCDMA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_WCDMA => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x9b, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC10 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC10 => new CRCConfig() - { - HashSizeInBits = 10, - Polynomial = 0x233, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC10_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC10_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 10, - Polynomial = 0x3d9, - InitialValue = 0x3ff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC11 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC11 => new CRCConfig() - { - HashSizeInBits = 11, - Polynomial = 0x385, - InitialValue = 0x01a, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_3GPP standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_3GPP => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0x80f, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = true, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0xf13, - InitialValue = 0xfff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_DECT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_DECT => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0x80f, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC13_BBC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC13_BBC => new CRCConfig() - { - HashSizeInBits = 13, - Polynomial = 0x1cf5, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC14_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC14_DARC => new CRCConfig() - { - HashSizeInBits = 14, - Polynomial = 0x0805, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC15 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC15 => new CRCConfig() - { - HashSizeInBits = 15, - Polynomial = 0x4599, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC15_MPT1327 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC15_MPT1327 => new CRCConfig() - { - HashSizeInBits = 15, - Polynomial = 0x6815, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0001, - }.Clone(); - - /// - /// Creates an instance of configured to the ARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig ARC => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_AUGCCITT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_AUGCCITT => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x1d0f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_BUYPASS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_BUYPASS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_CCITTFALSE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_CCITTFALSE => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0xc867, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DDS110 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DDS110 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x800d, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DECTR standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DECTR => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x0589, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0001, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DECTX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DECTX => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x0589, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DNP standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DNP => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x3d65, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_EN13757 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_EN13757 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x3d65, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_GENIBUS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_GENIBUS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_MAXIM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_MAXIM => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_MCRF4XX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_MCRF4XX => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_RIELLO standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_RIELLO => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xb2aa, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_T10DIF standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_T10DIF => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8bb7, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_TELEDISK standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_TELEDISK => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0xa097, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_TMS37157 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_TMS37157 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x89ec, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_USB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_USB => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRCA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRCA => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xc6c6, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the KERMIT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig KERMIT => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the MODBUS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig MODBUS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the X25 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig X25 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the XMODEM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig XMODEM => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24 => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x864cfb, - InitialValue = 0xb704ce, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24_FLEXRAYA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24_FLEXRAYA => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x5d6dcb, - InitialValue = 0xfedcba, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24_FLEXRAYB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24_FLEXRAYB => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x5d6dcb, - InitialValue = 0xabcdef, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC31_PHILIPS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC31_PHILIPS => new CRCConfig() - { - HashSizeInBits = 31, - Polynomial = 0x04c11db7, - InitialValue = 0x7fffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x7fffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_BZIP2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_BZIP2 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32C standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32C => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x1edc6f41, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32D standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32D => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0xa833982b, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_MPEG2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_MPEG2 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_POSIX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_POSIX => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32Q standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32Q => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x814141ab, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the JAMCRC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig JAMCRC => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the XFER standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig XFER => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x000000af, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC40_GSM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC40_GSM => new CRCConfig() - { - HashSizeInBits = 40, - Polynomial = 0x0004820009, - InitialValue = 0x0000000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64 => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = 0x0000000000000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000000000000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64_WE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64_WE => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = unchecked((long)0xffffffffffffffff), - ReflectIn = false, - ReflectOut = false, - XOrOut = unchecked((long)0xffffffffffffffff), - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64_XZ standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64_XZ => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = unchecked((long)0xffffffffffffffff), - ReflectIn = true, - ReflectOut = true, - XOrOut = unchecked((long)0xffffffffffffffff), - }.Clone(); - - #endregion - /// - /// Makes a deep clone of the current instance. + /// Makes a deep clone of current instance. /// /// A deep clone of the current instance. public ICRCConfig Clone() => diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs new file mode 100644 index 0000000..25e831d --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("ARC", "ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileARC : CRCConfig + { + /// + /// Creates an instance of configured to the ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileARC() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs new file mode 100644 index 0000000..af65277 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC10", "CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC10 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC10() + { + HashSizeInBits = 10; + Polynomial = 0x233; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs new file mode 100644 index 0000000..7cc1c15 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC10/CDMA2000", "CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC10_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC10_CDMA2000() + { + HashSizeInBits = 10; + Polynomial = 0x3D9; + InitialValue = unchecked((long)0x3FF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs new file mode 100644 index 0000000..743e400 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC11", "CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC11 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC11() + { + HashSizeInBits = 11; + Polynomial = 0x385; + InitialValue = unchecked((long)0x1A); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs new file mode 100644 index 0000000..a44bdf3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/3GPP", "CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_3GPP : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_3GPP() + { + HashSizeInBits = 12; + Polynomial = 0x80F; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs new file mode 100644 index 0000000..a9c8368 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/CDMA2000", "CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_CDMA2000() + { + HashSizeInBits = 12; + Polynomial = 0xF13; + InitialValue = unchecked((long)0xFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs new file mode 100644 index 0000000..c5322aa --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/DECT", "CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_DECT : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_DECT() + { + HashSizeInBits = 12; + Polynomial = 0x80F; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs new file mode 100644 index 0000000..0fbfe02 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC13/BBC", "CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC13_BBC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC13_BBC() + { + HashSizeInBits = 13; + Polynomial = 0x1CF5; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs new file mode 100644 index 0000000..321fc89 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC14/DARC", "CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC14_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC14_DARC() + { + HashSizeInBits = 14; + Polynomial = 0x805; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs new file mode 100644 index 0000000..9d52fee --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC15", "CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC15 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC15() + { + HashSizeInBits = 15; + Polynomial = 0x4599; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs new file mode 100644 index 0000000..3d7e0fb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC15/MPT1327", "CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC15_MPT1327 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC15_MPT1327() + { + HashSizeInBits = 15; + Polynomial = 0x6815; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x1); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs new file mode 100644 index 0000000..42daa9b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/AUGCCITT", "CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_AUGCCITT : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_AUGCCITT() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x1D0F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs new file mode 100644 index 0000000..29121e9 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/BUYPASS", "CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_BUYPASS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_BUYPASS() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs new file mode 100644 index 0000000..8b674f2 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/CCITTFALSE", "CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_CCITTFALSE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_CCITTFALSE() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs new file mode 100644 index 0000000..ad9837a --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/CDMA2000", "CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_CDMA2000() + { + HashSizeInBits = 16; + Polynomial = 0xC867; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs new file mode 100644 index 0000000..0adab83 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DDS110", "CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DDS110 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DDS110() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x800D); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs new file mode 100644 index 0000000..c13fba3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DECTR", "CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DECTR : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DECTR() + { + HashSizeInBits = 16; + Polynomial = 0x589; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x1); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs new file mode 100644 index 0000000..b31a09b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DECTX", "CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DECTX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DECTX() + { + HashSizeInBits = 16; + Polynomial = 0x589; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs new file mode 100644 index 0000000..c37b320 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DNP", "CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DNP : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DNP() + { + HashSizeInBits = 16; + Polynomial = 0x3D65; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs new file mode 100644 index 0000000..7a563d2 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/EN13757", "CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_EN13757 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_EN13757() + { + HashSizeInBits = 16; + Polynomial = 0x3D65; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs new file mode 100644 index 0000000..eaf491c --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/GENIBUS", "CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_GENIBUS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_GENIBUS() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs new file mode 100644 index 0000000..e2bd5cf --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/MAXIM", "CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_MAXIM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_MAXIM() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs new file mode 100644 index 0000000..01cf5fc --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/MCRF4XX", "CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_MCRF4XX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_MCRF4XX() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs new file mode 100644 index 0000000..11ba045 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/RIELLO", "CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_RIELLO : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_RIELLO() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xB2AA); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs new file mode 100644 index 0000000..57ff565 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/T10DIF", "CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_T10DIF : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_T10DIF() + { + HashSizeInBits = 16; + Polynomial = 0x8BB7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs new file mode 100644 index 0000000..b7a8965 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/TELEDISK", "CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_TELEDISK : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_TELEDISK() + { + HashSizeInBits = 16; + Polynomial = 0xA097; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs new file mode 100644 index 0000000..1ceffbe --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/TMS37157", "CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_TMS37157 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_TMS37157() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x89EC); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs new file mode 100644 index 0000000..3864827 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/USB", "CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_USB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_USB() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs new file mode 100644 index 0000000..936ad50 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24", "CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24() + { + HashSizeInBits = 24; + Polynomial = 0x864CFB; + InitialValue = unchecked((long)0xB704CE); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs new file mode 100644 index 0000000..329266e --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24/FLEXRAYA", "CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24_FLEXRAYA : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24_FLEXRAYA() + { + HashSizeInBits = 24; + Polynomial = 0x5D6DCB; + InitialValue = unchecked((long)0xFEDCBA); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs new file mode 100644 index 0000000..d295b82 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24/FLEXRAYB", "CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24_FLEXRAYB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24_FLEXRAYB() + { + HashSizeInBits = 24; + Polynomial = 0x5D6DCB; + InitialValue = unchecked((long)0xABCDEF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs new file mode 100644 index 0000000..f47d549 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC31/PHILIPS", "CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC31_PHILIPS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC31_PHILIPS() + { + HashSizeInBits = 31; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0x7FFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x7FFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs new file mode 100644 index 0000000..b6a4035 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32", "CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs new file mode 100644 index 0000000..e55eb39 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32C", "CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32C : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32C() + { + HashSizeInBits = 32; + Polynomial = 0x1EDC6F41; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs new file mode 100644 index 0000000..c42391f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32D", "CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32D : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32D() + { + HashSizeInBits = 32; + Polynomial = 0xA833982B; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs new file mode 100644 index 0000000..4bab4cb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32Q", "CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32Q : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32Q() + { + HashSizeInBits = 32; + Polynomial = 0x814141AB; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs new file mode 100644 index 0000000..55bb955 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/BZIP2", "CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_BZIP2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_BZIP2() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs new file mode 100644 index 0000000..69816ab --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/MPEG2", "CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_MPEG2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_MPEG2() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs new file mode 100644 index 0000000..095d914 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/POSIX", "CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_POSIX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_POSIX() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs new file mode 100644 index 0000000..81b3ba9 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC3/ROHC", "CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC3_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC3_ROHC() + { + HashSizeInBits = 3; + Polynomial = 0x3; + InitialValue = unchecked((long)0x7); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs new file mode 100644 index 0000000..826d877 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC40/GSM", "CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC40_GSM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC40_GSM() + { + HashSizeInBits = 40; + Polynomial = 0x4820009; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs new file mode 100644 index 0000000..8137dd4 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC4/ITU", "CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC4_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC4_ITU() + { + HashSizeInBits = 4; + Polynomial = 0x3; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs new file mode 100644 index 0000000..9b152e0 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/EPC", "CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_EPC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_EPC() + { + HashSizeInBits = 5; + Polynomial = 0x9; + InitialValue = unchecked((long)0x9); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs new file mode 100644 index 0000000..5af3f0b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/ITU", "CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_ITU() + { + HashSizeInBits = 5; + Polynomial = 0x15; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs new file mode 100644 index 0000000..266febf --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/USB", "CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_USB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_USB() + { + HashSizeInBits = 5; + Polynomial = 0x5; + InitialValue = unchecked((long)0x1F); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x1F); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs new file mode 100644 index 0000000..7776108 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64", "CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs new file mode 100644 index 0000000..1913d0a --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64/WE", "CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64_WE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64_WE() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0xFFFFFFFFFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs new file mode 100644 index 0000000..fd94a01 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64/XZ", "CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64_XZ : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64_XZ() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0xFFFFFFFFFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs new file mode 100644 index 0000000..8af4c06 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/CDMA2000A", "CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_CDMA2000A : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_CDMA2000A() + { + HashSizeInBits = 6; + Polynomial = 0x27; + InitialValue = unchecked((long)0x3F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs new file mode 100644 index 0000000..3bb6644 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/CDMA2000B", "CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_CDMA2000B : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_CDMA2000B() + { + HashSizeInBits = 6; + Polynomial = 0x7; + InitialValue = unchecked((long)0x3F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs new file mode 100644 index 0000000..448a0ff --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/DARC", "CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_DARC() + { + HashSizeInBits = 6; + Polynomial = 0x19; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs new file mode 100644 index 0000000..a968cb6 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/ITU", "CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_ITU() + { + HashSizeInBits = 6; + Polynomial = 0x3; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs new file mode 100644 index 0000000..a9ccad6 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC7", "CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC7 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC7() + { + HashSizeInBits = 7; + Polynomial = 0x9; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs new file mode 100644 index 0000000..61708bc --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC7/ROHC", "CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC7_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC7_ROHC() + { + HashSizeInBits = 7; + Polynomial = 0x4F; + InitialValue = unchecked((long)0x7F); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs new file mode 100644 index 0000000..0606ad3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8", "CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs new file mode 100644 index 0000000..3638adb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/CDMA2000", "CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_CDMA2000() + { + HashSizeInBits = 8; + Polynomial = 0x9B; + InitialValue = unchecked((long)0xFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs new file mode 100644 index 0000000..01f4189 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/DARC", "CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_DARC() + { + HashSizeInBits = 8; + Polynomial = 0x39; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs new file mode 100644 index 0000000..a9a6906 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/DVBS2", "CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_DVBS2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_DVBS2() + { + HashSizeInBits = 8; + Polynomial = 0xD5; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs new file mode 100644 index 0000000..9cac15f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/EBU", "CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_EBU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_EBU() + { + HashSizeInBits = 8; + Polynomial = 0x1D; + InitialValue = unchecked((long)0xFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs new file mode 100644 index 0000000..a2ac456 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ICODE", "CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ICODE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ICODE() + { + HashSizeInBits = 8; + Polynomial = 0x1D; + InitialValue = unchecked((long)0xFD); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs new file mode 100644 index 0000000..f2f42ee --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ITU", "CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ITU() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x55); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs new file mode 100644 index 0000000..e4610ec --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/MAXIM", "CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_MAXIM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_MAXIM() + { + HashSizeInBits = 8; + Polynomial = 0x31; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs new file mode 100644 index 0000000..f1285b3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ROHC", "CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ROHC() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0xFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs new file mode 100644 index 0000000..8fa0aa0 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/WCDMA", "CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_WCDMA : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_WCDMA() + { + HashSizeInBits = 8; + Polynomial = 0x9B; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs new file mode 100644 index 0000000..6bf64be --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRCA", "CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRCA : CRCConfig + { + /// + /// Creates an instance of configured to the CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRCA() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xC6C6); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs new file mode 100644 index 0000000..ff3609f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("JAMCRC", "JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileJAMCRC : CRCConfig + { + /// + /// Creates an instance of configured to the JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileJAMCRC() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs new file mode 100644 index 0000000..86f4901 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("KERMIT", "KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileKERMIT : CRCConfig + { + /// + /// Creates an instance of configured to the KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileKERMIT() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs new file mode 100644 index 0000000..942317f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("MODBUS", "MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileMODBUS : CRCConfig + { + /// + /// Creates an instance of configured to the MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileMODBUS() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs new file mode 100644 index 0000000..c8f740b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("X25", "X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileX25 : CRCConfig + { + /// + /// Creates an instance of configured to the X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileX25() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs new file mode 100644 index 0000000..b13f469 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("XFER", "XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileXFER : CRCConfig + { + /// + /// Creates an instance of configured to the XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileXFER() + { + HashSizeInBits = 32; + Polynomial = 0xAF; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs new file mode 100644 index 0000000..4f45b7c --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("XMODEM", "XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileXMODEM : CRCConfig + { + /// + /// Creates an instance of configured to the XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileXMODEM() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs new file mode 100644 index 0000000..a32b365 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the Fowler-Noll-Vo (FNV) hash algorithm with a 1024-bit hash size. + /// + /// This class defines the parameters specific to the 1024-bit variant of the FNV hash algorithm, + /// including the hash size, prime, and offset values. These parameters are pre-defined constants tailored for the + /// 1024-bit configuration. Use this profile when a 1024-bit hash size is required for hashing operations. + [DefineHashConfigProfile("1024Bits", "Represents the configuration profile for the Fowler-Noll-Vo (FNV) hash algorithm with a 1024-bit hash size.")] + public sealed class FNVConfigProfile1024Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the Fowler-Noll-Vo + /// (FNV) hash algorithm for 1024-bit hash size. + /// + /// This constructor sets the hash size to 1024 bits and initializes the prime and offset values used + /// in the FNV-1 hash algorithm. The prime and offset values are pre-defined constants specific to the 1024-bit + /// variant of the algorithm. + public FNVConfigProfile1024Bits() + { + HashSizeInBits = 1024; + Prime = BigInteger.Parse("5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573"); + Offset = BigInteger.Parse("14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs new file mode 100644 index 0000000..b665be8 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs @@ -0,0 +1,59 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 128-bit Fowler-Noll-Vo (FNV) hash algorithm. + /// + /// This class defines the parameters specific to the 128-bit variant of the FNV-1 and FNV-1a hash + /// algorithms, including the hash size, prime, and offset values. These parameters are based on the standard + /// constants for the 128-bit FNV hash function. Use this class to configure and initialize a hash function + /// that operates with a 128-bit hash size. + [DefineHashConfigProfile("128Bits", "Represents the configuration profile for the 128-bit Fowler-Noll-Vo (FNV) hash algorithm.")] + public sealed class FNVConfigProfile128Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 128-bit Fowler-Noll-Vo hash function. + /// + /// This constructor sets the hash size to 128 bits and initializes the prime and offset values + /// specific to the 128-bit FNV-1/FNV-1a hash algorithm. These values are based on the standard constants defined for + /// the 128-bit variant of the algorithm. + public FNVConfigProfile128Bits() + { + HashSizeInBits = 128; + Prime = BigInteger.Parse("309485009821345068724781371"); + Offset = BigInteger.Parse("144066263297769815596495629667062367629"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs new file mode 100644 index 0000000..ca4fd24 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs @@ -0,0 +1,59 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents a predefined configuration profile for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash + /// algorithm. + /// + /// This configuration profile is specifically tailored for computing 256-bit FNV-1 hashes. It defines + /// the hash size, prime, and offset values according to the standard constants for the 256-bit FNV-1 algorithm. Use + /// this class to simplify the setup of hash computations requiring a 256-bit hash size. + [DefineHashConfigProfile("256Bits", "Represents a predefined configuration profile for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash algorithm.")] + public sealed class FNVConfigProfile256Bits : FNVConfig + { + /// + /// Initializes a new instance of the class with predefined settings for a + /// 256-bit FNV-1 hash configuration. + /// + /// This constructor sets the hash size to 256 bits and initializes the prime and offset values to + /// the constants defined for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash algorithm. These values are used + /// to configure the hash computation. + public FNVConfigProfile256Bits() + { + HashSizeInBits = 256; + Prime = BigInteger.Parse("374144419156711147060143317175368453031918731002211"); + Offset = BigInteger.Parse("100029257958052580907070968620625704837092796014241193945225284501741471925557"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs new file mode 100644 index 0000000..146162c --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs @@ -0,0 +1,57 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for a 32-bit FNV (Fowler–Noll–Vo) hash function. + /// + /// This profile defines the parameters for the 32-bit FNV-1 and FNV-1a hash algorithms, including the + /// hash size, prime, and offset values. It is designed for use in scenarios where a 32-bit hash is required, such as + /// checksum calculations or hash-based data structures. + [DefineHashConfigProfile("32Bits", "Represents the configuration profile for a 32-bit FNV (Fowler–Noll–Vo) hash function.")] + public sealed class FNVConfigProfile32Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 32-bit FNV (Fowler–Noll–Vo) hash function. + /// + /// This constructor sets the hash size to 32 bits and initializes the prime and offset values + /// commonly used for the 32-bit FNV-1 and FNV-1a hash algorithms. + public FNVConfigProfile32Bits() + { + HashSizeInBits = 32; + Prime = new BigInteger(16777619); + Offset = new BigInteger(2166136261); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs new file mode 100644 index 0000000..ca29fcf --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 512-bit FNV-1 hash function. + /// + /// This class defines the parameters specific to the 512-bit variant of the Fowler-Noll-Vo (FNV-1) + /// hash algorithm, including the hash size, prime, and offset values. These parameters are based on the standard + /// specification for 512-bit FNV-1 hashes and are used to configure the hash computation. + [DefineHashConfigProfile("512Bits", "Represents the configuration profile for the 512-bit FNV-1 hash function.")] + public sealed class FNVConfigProfile512Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 512-bit FNV-1 hash function. + /// + /// This constructor sets the hash size to 512 bits and initializes the prime and offset values + /// specific to the 512-bit FNV-1 hash algorithm. These values are used in the computation of the hash and are based + /// on the standard FNV-1 specification for 512-bit hashes. + public FNVConfigProfile512Bits() + { + HashSizeInBits = 512; + Prime = BigInteger.Parse("35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759"); + Offset = BigInteger.Parse("9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs new file mode 100644 index 0000000..7124061 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs @@ -0,0 +1,56 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm. + /// + /// This class defines the parameters specific to the 64-bit FNV hash algorithm, including the hash + /// size, prime, and offset values. It is a sealed class and cannot be inherited. + [DefineHashConfigProfile("64Bits", "Represents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm.")] + public sealed class FNVConfigProfile64Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 64-bit FNV (Fowler–Noll–Vo) hash algorithm. + /// + /// This constructor sets the hash size to 64 bits and initializes the prime and offset values + /// specific to the 64-bit variant of the FNV hash algorithm. + public FNVConfigProfile64Bits() + { + HashSizeInBits = 64; + Prime = new BigInteger(1099511628211); + Offset = new BigInteger(14695981039346656037); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/FNVConfig.cs b/HashifyNet/Algorithms/FNV/FNVConfig.cs index 5b4abf1..f828f10 100644 --- a/HashifyNet/Algorithms/FNV/FNVConfig.cs +++ b/HashifyNet/Algorithms/FNV/FNVConfig.cs @@ -27,8 +27,7 @@ // ****************************************************************************** // * -using System; -using System.Collections.Generic; +using HashifyNet.Core; using System.Numerics; namespace HashifyNet.Algorithms.FNV @@ -36,6 +35,12 @@ namespace HashifyNet.Algorithms.FNV /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(FNVConfigProfile32Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile64Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile128Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile256Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile512Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile1024Bits))] public class FNVConfig : IFNVConfig { @@ -74,72 +79,5 @@ public IFNVConfig Clone() => Prime = Prime, Offset = Offset }; - - private static readonly IReadOnlyDictionary _predefinedConfigs = - new Dictionary() { - { - 32, - new FNVConfig() { - HashSizeInBits = 32, - Prime = new BigInteger(16777619), - Offset = new BigInteger(2166136261) - } - }, - { - 64, - new FNVConfig() { - HashSizeInBits = 64, - Prime = new BigInteger(1099511628211), - Offset = new BigInteger(14695981039346656037) - } - }, - { - 128, - new FNVConfig() { - HashSizeInBits = 128, - Prime = BigInteger.Parse("309485009821345068724781371"), - Offset = BigInteger.Parse("144066263297769815596495629667062367629") - } - }, - { - 256, - new FNVConfig() { - HashSizeInBits = 256, - Prime = BigInteger.Parse("374144419156711147060143317175368453031918731002211"), - Offset = BigInteger.Parse("100029257958052580907070968620625704837092796014241193945225284501741471925557") - } - }, - { - 512, - new FNVConfig() { - HashSizeInBits = 512, - Prime = BigInteger.Parse("35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759"), - Offset = BigInteger.Parse("9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785") - } - }, - { - 1024, - new FNVConfig() { - HashSizeInBits = 1024, - Prime = BigInteger.Parse("5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573"), - Offset = BigInteger.Parse("14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915") - } - } - }; - - /// - /// Gets one of the predefined configurations as defined at http://www.isthe.com/chongo/tech/comp/fnv/index.html. - /// - /// The desired hash length, in bits. - /// The predefined configuration instance. - public static IFNVConfig GetPredefinedConfig(int hashSizeInBits) - { - if (!_predefinedConfigs.TryGetValue(hashSizeInBits, out var config)) - { - throw new ArgumentOutOfRangeException(nameof(hashSizeInBits), hashSizeInBits, $"{nameof(hashSizeInBits)} must be a positive power of 2 between 32 and 1024."); - } - - return config; - } } -} \ No newline at end of file +} diff --git a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs index dc62ba2..f59a89a 100644 --- a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs +++ b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs @@ -29,12 +29,14 @@ using System.Collections.Generic; using System.Linq; +using HashifyNet.Core; namespace HashifyNet.Algorithms.Pearson { /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(PearsonConfigProfileWikipedia))] public class PearsonConfig : IPearsonConfig { @@ -65,4 +67,4 @@ public IPearsonConfig Clone() => HashSizeInBits = HashSizeInBits }; } -} \ No newline at end of file +} diff --git a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs similarity index 91% rename from HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs rename to HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs index d02d7b6..e3179b9 100644 --- a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs +++ b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs @@ -28,6 +28,7 @@ // * using System.Collections.Generic; +using HashifyNet.Core; namespace HashifyNet.Algorithms.Pearson { @@ -41,7 +42,8 @@ namespace HashifyNet.Algorithms.Pearson /// There is nothing special about this configuration's lookup table that makes it explicitly /// better or worse than other valid lookup tables. /// - public class WikipediaPearsonConfig + [DefineHashConfigProfile("Wikipedia", "Specifically contains a configuration for Pearson hashing using the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21.")] + public sealed class PearsonConfigProfileWikipedia : IPearsonConfig { /// @@ -87,9 +89,10 @@ public class WikipediaPearsonConfig /// /// A deep clone of the current instance. public IPearsonConfig Clone() => - new WikipediaPearsonConfig() + new PearsonConfigProfileWikipedia() { HashSizeInBits = HashSizeInBits }; } -} \ No newline at end of file + +} diff --git a/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs new file mode 100644 index 0000000..df84f8f --- /dev/null +++ b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs @@ -0,0 +1,83 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core.Utilities; +using System; + +namespace HashifyNet.Core +{ + /// + /// Specifies the configuration profile types associated with a class. + /// + /// This attribute is used to associate one or more configuration profile types with a class. Each + /// specified type must meet the following criteria: It must be a non-abstract + /// class. It must be marked with the . It must implement the interface. + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + internal sealed class DeclareHashConfigProfileAttribute : Attribute + { + public Type ProfileType { get; } + + public DeclareHashConfigProfileAttribute(Type profileType) + { + if (profileType == null) + { + throw new ArgumentException($"{nameof(profileType)} must not contain null values.", nameof(profileType)); + } + + if (!profileType.IsClass) + { + throw new ArgumentException($"{nameof(profileType)} must only contain class types.", nameof(profileType)); + } + + if (profileType.IsAbstract) + { + throw new ArgumentException($"{nameof(profileType)} must not contain abstract class types.", nameof(profileType)); + } + + if (!Attribute.IsDefined(profileType, typeof(DefineHashConfigProfileAttribute), false)) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types marked with {nameof(DefineHashConfigProfileAttribute)}.", nameof(profileType)); + } + + if (!profileType.HasInterface(typeof(IHashConfigBase))) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types implementing {nameof(IHashConfigBase)}.", nameof(profileType)); + } + + if (!profileType.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 0)) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types with a public parameterless constructor.", nameof(profileType)); + } + + ProfileType = profileType; + } + } +} diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs new file mode 100644 index 0000000..1fa29a8 --- /dev/null +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -0,0 +1,87 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet.Core +{ + /// + /// Marks a class as a standard, discoverable hash configuration. + /// + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + internal sealed class DefineHashConfigProfileAttribute : Attribute + { + private const int MinNameLength = 3; + private const int MaxNameLength = 64; + private const int MinDescriptionLength = 32; + private const int MaxDescriptionLength = 2048; + + public string Name { get; } + public string Description { get; } + + public DefineHashConfigProfileAttribute(string name, string description = null +#if NET8_0_OR_GREATER + ! +#endif + ) + { + if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); + } + + if (name.Length < MinNameLength) + { + throw new ArgumentException($"The config profile name must be at least {MinNameLength} characters in length. Current: {name}", nameof(name)); + } + + if (name.Length > MaxNameLength) + { + throw new ArgumentException($"The config profile name must not exceed {MaxNameLength} characters in length. Current: {name}", nameof(name)); + } + + if (description != null) + { + if (description.Length < MinDescriptionLength) + { + throw new ArgumentException($"The config profile description must be at least {MinDescriptionLength} characters in length. Current: {description}", nameof(description)); + } + + if (description.Length > MaxDescriptionLength) + { + throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length. Current: {description}", nameof(description)); + } + } + + Name = name; + Description = description; + } + } +} + diff --git a/HashifyNet/Core/Config/HashConfigProfile.cs b/HashifyNet/Core/Config/HashConfigProfile.cs new file mode 100644 index 0000000..e0b3ede --- /dev/null +++ b/HashifyNet/Core/Config/HashConfigProfile.cs @@ -0,0 +1,71 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet +{ + internal sealed class HashConfigProfile : IHashConfigProfile + { + public Type ProfileType { get; } + public string Name { get; } + public string Description { get; } + + private Func _profileFactory; + public HashConfigProfile(Type profileType, string name, string description, Func profileFactory) + { + if (profileType == null) + { + throw new ArgumentNullException(nameof(profileType), "The profile type cannot be null."); + } + + if (!typeof(IHashConfigBase).IsAssignableFrom(profileType)) + { + throw new ArgumentException($"The profile type must implement {nameof(IHashConfigBase)} interface.", nameof(profileType)); + } + + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("The profile name must be a non-empty string.", nameof(name)); + } + + if (profileFactory == null) + { + throw new ArgumentNullException(nameof(profileFactory), "The profile factory function cannot be null."); + } + + ProfileType = profileType; + Name = name; + Description = description; + _profileFactory = profileFactory; + } + + public IHashConfigBase Create() => _profileFactory(); + } +} diff --git a/HashifyNet/Core/Config/IHashConfigProfile.cs b/HashifyNet/Core/Config/IHashConfigProfile.cs new file mode 100644 index 0000000..008f731 --- /dev/null +++ b/HashifyNet/Core/Config/IHashConfigProfile.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet +{ + /// + /// Represents a configuration profile for a hash algorithm. + /// + public interface IHashConfigProfile + { + /// + /// Gets the type of the config profile's class. + /// + Type ProfileType { get; } + + /// + /// Gets the name of the underlying config profile. + /// + string Name { get; } + + /// + /// Gets the description of the underlying config profile. This may be . + /// + string Description { get; } + + /// + /// Creates an instance of the underlying config profile. + /// + /// An instance of representing the configuration profile. + IHashConfigBase Create(); + } +} diff --git a/HashifyNet/Core/Factory/HashFactory.Extensions.cs b/HashifyNet/Core/Factory/HashFactory.Extensions.cs index a32d827..ab3a3b5 100644 --- a/HashifyNet/Core/Factory/HashFactory.Extensions.cs +++ b/HashifyNet/Core/Factory/HashFactory.Extensions.cs @@ -157,6 +157,26 @@ public static Type[] GetUnavailableHashAlgorithms() } #endif + /// + /// Retrieves the configuration profiles associated with the specified hash algorithm interface type. + /// + /// The type of hash algorithm interface for which to retrieve the configuration profiles. Cannot be . + /// An array of objects associated with the specified type, or an empty array + /// if no configuration profiles are found for the specified type. + /// Thrown if is . + public static IHashConfigProfile[] GetConfigProfiles(Type type) + { + _ = type ?? throw new ArgumentNullException(nameof(type)); + if (!_configProfiles.ContainsKey(type)) + { + return Array.Empty(); + } + else + { + return (IHashConfigProfile[])_configProfiles[type]; + } + } + /// /// Retrieves an array of concrete configuration types associated with the specified hash function type. /// @@ -200,13 +220,13 @@ public static IHashConfigBase CreateDefaultConcreteConfig(Type type) throw new KeyNotFoundException($"No implementation registered for type '{type.FullName}'."); } - Func configFactory = ((Tuple, Func>)_implementations[type]).Item2; + Func configFactory = ((Tuple, Func>)_implementations[type]).Item2; if (configFactory == null) { throw new NotSupportedException($"No default configuration available for type '{type.FullName}'."); } - return (IHashConfigBase)configFactory(null); + return configFactory(); } /// diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index d882feb..6484eda 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -27,11 +27,11 @@ // ****************************************************************************** // * +using HashifyNet.Core; using HashifyNet.Core.Utilities; using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Reflection; namespace HashifyNet @@ -62,6 +62,7 @@ private static HashFactory Singleton private static readonly Hashtable _concreteConfigTypes; private static readonly Hashtable _implementations; + private static readonly Hashtable _configProfiles; /// /// Initializes the static state of the class by discovering and registering available hash /// algorithm implementations. @@ -79,14 +80,15 @@ static HashFactory() { _implementations = new Hashtable(); _concreteConfigTypes = new Hashtable(); + _configProfiles = new Hashtable(); - Type[] types = ReflectionHelper.GetClasses(typeof(Core.HashAlgorithmImplementationAttribute), false); + Type[] types = ReflectionHelper.GetClasses(typeof(HashAlgorithmImplementationAttribute), false); if (types == null || types.Length < 1) { throw new InvalidOperationException("No hash algorithm implementations found."); } - List> validTypes = new List>(); + List> validTypes = new List>(); foreach (Type type in types) { if (type.GetCustomAttribute() != null) @@ -94,31 +96,18 @@ static HashFactory() continue; } - IEnumerable attrs = type.GetCustomAttributes(false); - if (attrs == null) + HashAlgorithmImplementationAttribute implementationAttribute = type.GetCustomAttribute(false); + if (implementationAttribute == null) { continue; } - bool exists = false; - foreach (Core.HashAlgorithmImplementationAttribute attr in attrs) - { - exists = true; - break; - } - - if (!exists) + if (!type.HasConstructor(BindingFlags.Public | BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) })) { continue; } - if (!type.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) })) - { - continue; - } - - Core.HashAlgorithmImplementationAttribute implattr = attrs.ElementAt(0); - validTypes.Add(new Tuple(type, implattr)); + validTypes.Add(new Tuple(type, implementationAttribute)); } if (validTypes.Count < 1) @@ -126,24 +115,73 @@ static HashFactory() throw new InvalidOperationException("No valid hash algorithm implementations found."); } - foreach (Tuple t in validTypes) + foreach (Tuple t in validTypes) { - ConstructorInfo factoryCtor = t.Item1.GetConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) }); - Func factory = ReflectionHelper.CreateInstanceWithParameters(factoryCtor, factoryCtor.GetParameters()[0].ParameterType); + ConstructorInfo factoryCtor = t.Item1.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) }); + Func factory = ReflectionHelper.CreateInstanceWithSingleParameter(factoryCtor); Type configType = t.Item2.ConcreteConfig; _concreteConfigTypes.Add(t.Item2.ImplementedInterface, configType); + IEnumerable configProfileDeclarationAttributes = configType.GetCustomAttributes(false); + List configProfileTypes = null; + foreach (DeclareHashConfigProfileAttribute attr in configProfileDeclarationAttributes) + { + if (configProfileTypes == null) + { + configProfileTypes = new List(); + } + + if (attr != null) + { + // Assuming ProfileType is ensured to be non-null and valid by the attribute's constructor. + configProfileTypes.Add(attr.ProfileType); + } + } + + if (configProfileTypes != null && configProfileTypes.Count > 0) + { + // Create instances of each config profile type and push them into an array then to the lookup table. + // This implementation assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. + { + IHashConfigProfile[] profiles = new IHashConfigProfile[configProfileTypes.Count]; + for (int i = 0; i < configProfileTypes.Count; ++i) + { + Type configProfileType = configProfileTypes[i]; + ConstructorInfo configProfileCtor = configProfileType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); + if (configProfileCtor == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' does not have a public parameterless constructor. This should not have happened in normal cases, so it probably points to a bug."); + } + + DefineHashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); + if (configProfileAttribute == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(DefineHashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); + } + + Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); + profiles[i] = new HashConfigProfile(configProfileType, configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); + } + + _configProfiles.Add(t.Item2.ImplementedInterface, profiles); + } + } + // If the concrete config has no parameterless constructor, we cannot create a default instance. In this case, the parameterless Create function will throw. - Func configFactory = null; + Func configFactory = null; ConstructorInfo configCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); if (configCtor != null) { - configFactory = ReflectionHelper.CreateInstanceWithParameters(configCtor); + configFactory = ReflectionHelper.CreateInstance(configCtor); } - _implementations.Add(t.Item2.ImplementedInterface, Tuple.Create, Func>(factory, configFactory)); + _implementations.Add(t.Item2.ImplementedInterface, Tuple.Create, Func>(factory, configFactory)); } } @@ -181,13 +219,13 @@ public IHashFunctionBase CreateInstance(Type type) throw new NotImplementedException($"No implementation found for type {type.FullName}."); } - Tuple, Func> factory = (Tuple, Func>)_implementations[type]; + Tuple, Func> factory = (Tuple, Func>)_implementations[type]; if (factory.Item2 == null) { throw new NotImplementedException($"No default configuration available for type {type.FullName}."); } - return (IHashFunctionBase)factory.Item1(new object[] { factory.Item2(null) }); + return factory.Item1(factory.Item2()); } /// @@ -226,8 +264,8 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) throw new NotImplementedException($"No implementation found for type {type.FullName}."); } - Tuple, Func> factory = (Tuple, Func>)_implementations[type]; - return (IHashFunctionBase)factory.Item1(new object[] { config }); + Tuple, Func> factory = (Tuple, Func>)_implementations[type]; + return factory.Item1(config); } } } diff --git a/HashifyNet/Core/Utilities/ReflectionHelper.cs b/HashifyNet/Core/Utilities/ReflectionHelper.cs index 86afdd0..405a761 100644 --- a/HashifyNet/Core/Utilities/ReflectionHelper.cs +++ b/HashifyNet/Core/Utilities/ReflectionHelper.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -183,7 +183,7 @@ public static ConstructorInfo GetConstructor(this Type type, BindingFlags flags, return retval; } - public static Func CreateInstanceWithParameters(ConstructorInfo ctor, params Type[] parameterTypes) + public static Func CreateInstanceWithParameters(ConstructorInfo ctor, params Type[] parameterTypes) { _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); var argumentsParameter = Expression.Parameter(typeof(object[]), "args"); @@ -195,9 +195,54 @@ public static Func CreateInstanceWithParameters(ConstructorInf }).ToArray(); var newExpression = Expression.New(ctor, parameterExpressions); - var convertExpression = Expression.Convert(newExpression, typeof(object)); + var convertExpression = Expression.Convert(newExpression, typeof(TType)); + + var lambda = Expression.Lambda>(convertExpression, argumentsParameter); + return lambda.Compile(); + } + + public static Func CreateInstanceWithSingleParameter(ConstructorInfo ctor) + { + _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); + + ParameterInfo[] constructorParams = ctor.GetParameters(); + if (constructorParams.Length != 1) + { + throw new ArgumentException("The provided constructor must have exactly one parameter.", nameof(ctor)); + } + + ParameterExpression parameterExpression = Expression.Parameter(typeof(TParameter), "param"); + Expression argumentExpression = parameterExpression; + + Type constructorParamType = constructorParams[0].ParameterType; + if (parameterExpression.Type != constructorParamType) + { + argumentExpression = Expression.Convert(parameterExpression, constructorParamType); + } + + NewExpression newExpression = Expression.New(ctor, argumentExpression); + Expression> lambda; + if (newExpression.Type != typeof(TType)) + { + UnaryExpression convertExpression = Expression.Convert(newExpression, typeof(TType)); + lambda = Expression.Lambda>(convertExpression, parameterExpression); + } + else + { + lambda = Expression.Lambda>(newExpression, parameterExpression); + } + + return lambda.Compile(); + } + + public static Func CreateInstance(ConstructorInfo ctor) + { + _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); + + var newExpression = Expression.New(ctor); + var convertExpression = Expression.Convert(newExpression, typeof(TType)); - var lambda = Expression.Lambda>(convertExpression, argumentsParameter); + var lambda = Expression.Lambda>(convertExpression); return lambda.Compile(); }