public FastPositiveHash(FastPositiveHashVariant variant, UInt64 seed) { switch (variant) { case FastPositiveHashVariant.V0: m_Engine = new EngineV0(seed); break; case FastPositiveHashVariant.V1: m_Engine = new EngineV1(seed); break; default: m_Engine = new EngineV2(seed); break; } }
/// <summary>Initializes a new instance using the specified variant and seed.</summary> /// <param name="variant">The enumerator value of type <see cref="T:FastHashes.FastPositiveHashVariant"/> representing the variant of the hashing algorithm.</param> /// <param name="seed">The <see cref="T:System.UInt64"/> seed used by the hashing algorithm.</param> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">Thrown when the value of <paramref name="variant">variant</paramref> is undefined.</exception> public FastPositiveHash(FastPositiveHashVariant variant, UInt64 seed) { if (!Enum.IsDefined(typeof(FastPositiveHashVariant), variant)) { throw new InvalidEnumArgumentException("Invalid variant specified."); } switch (variant) { case FastPositiveHashVariant.V0: m_Engine = new EngineV0(seed); break; case FastPositiveHashVariant.V1: m_Engine = new EngineV1(seed); break; default: m_Engine = new EngineV2(seed); break; } }
/// <summary>Initializes a new instance using the specified variant and a seed value of <c>0</c>.</summary> /// <param name="variant">The enumerator value of type <see cref="T:FastHashes.FastPositiveHashVariant"/> representing the variant of the hashing algorithm.</param> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">Thrown when the value of <paramref name="variant">variant</paramref> is undefined.</exception> public FastPositiveHash(FastPositiveHashVariant variant) : this(variant, 0ul) { }