示例#1
0
        public SipHash(SipHashVariant variant, UInt64 seed1, UInt64 seed2)
        {
            if (variant == SipHashVariant.V13)
            {
                m_R1 = 1;
                m_R2 = 3;
            }
            else
            {
                m_R1 = 2;
                m_R2 = 4;
            }

            m_Variant = variant;
            m_Seed1   = seed1;
            m_Seed2   = seed2;
        }
示例#2
0
        /// <summary>Initializes a new instance using the specified variant and seeds.</summary>
        /// <param name="variant">The enumerator value of type <see cref="T:FastHashes.SipHashVariant"/> representing the variant of the hashing algorithm.</param>
        /// <param name="seed1">The first <see cref="T:System.UInt64"/> seed used by the hashing algorithm.</param>
        /// <param name="seed2">The second <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 SipHash(SipHashVariant variant, UInt64 seed1, UInt64 seed2)
        {
            if (!Enum.IsDefined(typeof(SipHashVariant), variant))
            {
                throw new InvalidEnumArgumentException("Invalid variant specified.");
            }

            if (variant == SipHashVariant.V13)
            {
                m_R1 = 1;
                m_R2 = 3;
            }
            else
            {
                m_R1 = 2;
                m_R2 = 4;
            }

            m_Variant = variant;
            m_Seed1   = seed1;
            m_Seed2   = seed2;
        }
示例#3
0
 public SipHash(SipHashVariant variant, UInt64 seed) : this(variant, seed, seed)
 {
 }
示例#4
0
 public SipHash(SipHashVariant variant) : this(variant, 0ul, 0ul)
 {
 }