public BlockTransformer_8Bit(BuzHashConfig config) : this()
            {
                _rtab           = config.Rtab;
                _shiftDirection = config.ShiftDirection;

                _hashValue = (byte)config.Seed;
            }
Exemple #2
0
        public void BuzHashConfig_Defaults_HaventChanged()
        {
            var buzHashConfig = new BuzHashConfig();

            Assert.Null(buzHashConfig.Rtab);

            Assert.Equal(64, buzHashConfig.HashSizeInBits);
            Assert.Equal(0UL, buzHashConfig.Seed);
            Assert.Equal(CircularShiftDirection.Left, buzHashConfig.ShiftDirection);
        }
Exemple #3
0
        public void BuzHashConfig_Clone_WithNullArrays_Works()
        {
            var buzHashConfig = new BuzHashConfig()
            {
                Rtab           = null,
                HashSizeInBits = 32,
                Seed           = 1337UL,
                ShiftDirection = CircularShiftDirection.Right
            };

            var buzHashConfigClone = buzHashConfig.Clone();

            Assert.IsType <BuzHashConfig>(buzHashConfigClone);

            Assert.Equal(buzHashConfig.Rtab, buzHashConfigClone.Rtab);
            Assert.Equal(buzHashConfig.HashSizeInBits, buzHashConfigClone.HashSizeInBits);
            Assert.Equal(buzHashConfig.Seed, buzHashConfigClone.Seed);
            Assert.Equal(buzHashConfig.ShiftDirection, buzHashConfigClone.ShiftDirection);
        }
        public void BuzHashFactory_Create_Config_Works()
        {
            var buzHashConfig = new BuzHashConfig()
            {
                Rtab           = new UInt64[256],
                HashSizeInBits = 32,
                Seed           = 1337UL,
                ShiftDirection = CircularShiftDirection.Right
            };

            var buzHashFactory = BuzHashFactory.Instance;
            var buzHash        = buzHashFactory.Create(buzHashConfig);

            Assert.NotNull(buzHash);
            Assert.IsType <BuzHash_Implementation>(buzHash);


            var resultingBuzHashConfig = buzHash.Config;

            Assert.Equal(buzHashConfig.Rtab, resultingBuzHashConfig.Rtab);
            Assert.Equal(buzHashConfig.HashSizeInBits, resultingBuzHashConfig.HashSizeInBits);
            Assert.Equal(buzHashConfig.Seed, resultingBuzHashConfig.Seed);
            Assert.Equal(buzHashConfig.ShiftDirection, resultingBuzHashConfig.ShiftDirection);
        }