public BuzHash_Implementation(IBuzHashConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _config = config.Clone(); if (_config.Rtab == null || _config.Rtab.Count != 256) { throw new ArgumentException($"{nameof(config.Rtab)} must be non-null list of 256 {nameof(UInt64)} values.", $"{nameof(config)}.{nameof(config.Rtab)}"); } if (!_validHashSizes.Contains(_config.HashSizeInBits)) { throw new ArgumentOutOfRangeException($"{nameof(config)}.{nameof(config.HashSizeInBits)}", _config.HashSizeInBits, $"{nameof(config)}.{nameof(config.HashSizeInBits)} must be contained within BuzHashBase.ValidHashSizes."); } if (_config.ShiftDirection != CircularShiftDirection.Left && _config.ShiftDirection != CircularShiftDirection.Right) { throw new ArgumentOutOfRangeException($"{nameof(config)}.{nameof(config.ShiftDirection)}", _config.ShiftDirection, $"{nameof(config)}.{nameof(config.ShiftDirection)} must be a valid {nameof(CircularShiftDirection)} value."); } }
public BlockTransformer_8Bit(IBuzHashConfig config) : this() { _rtab = config.Rtab; _shiftDirection = config.ShiftDirection; _hashValue = (byte)config.Seed; }
/// <summary> /// Creates a new <see cref="IBuzHash" /> instance with given configuration. /// </summary> /// <param name="config">The configuration to use.</param> /// <returns> /// A <see cref="IBuzHash" /> instance. /// </returns> /// <exception cref="ArgumentNullException">config</exception> public IBuzHash Create(IBuzHashConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } return(new BuzHash_Implementation(config)); }