public SpookyHash1Function(SpookyHashConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            _config = config.Clone();

            if (!_validHashSizes.Contains(_config.HashSizeInBits))
            {
                throw new ArgumentOutOfRangeException($"{nameof(config)}.{nameof(config.HashSizeInBits)}", _config.HashSizeInBits, $"{nameof(config)}.{nameof(config.HashSizeInBits)} must be contained within SpookyHashV1.ValidHashSizes.");
            }

            switch (_config.HashSizeInBits)
            {
            case 32:
                _seed1 = _config.Seed & 0xFFFFFFFF;
                _seed2 = _seed1;
                break;

            case 64:
                _seed1 = _config.Seed;
                _seed2 = _seed1;
                break;

            case 128:
                _seed1 = _config.Seed;
                _seed2 = _config.Seed2;
                break;
            }
        }
Пример #2
0
 public static ISpookyHash Create(SpookyHashTypes type, SpookyHashConfig config) => Factory.Create(type, config);