public override HashResult TransformFinal()
        {
            HashResult h = m_hash.TransformFinal();

            m_hash.TransformBytes(m_opad);
            m_hash.TransformBytes(h.GetBytes());
            h = m_hash.TransformFinal();
            Initialize();
            return(h);
        }
Esempio n. 2
0
        public override HashResult TransformFinal()
        {
            if (!m_bTransforming)
            {
                UpdatePads();
                m_hash.TransformBytes(m_ipad);
                m_bTransforming = true;
            }

            HashResult h = m_hash.TransformFinal();

            Initialize();
            m_hash.TransformBytes(m_opad);
            m_hash.TransformBytes(h.GetBytes());
            h = m_hash.TransformFinal();
            Initialize();
            return(h);
        }
Esempio n. 3
0
 internal bool Equals(HashResult a_hashResult)
 {
     return HashResult.SameArrays(a_hashResult.GetBytes(), m_hash);
 }
Esempio n. 4
0
 /// <summary>
 /// Determines whether a Hash Result is equal to another Hash Result
 /// </summary>
 /// <param name="a_hashResult"></param>
 /// <returns></returns>
 public bool Equals(HashResult a_hashResult)
 {
     return(HashResult.SameArrays(a_hashResult.GetBytes(), m_hash));
 }
Esempio n. 5
0
        public void HashResult()
        {
            for (int i = 0; i < 14; i++)
            {
                HashResult h1 = new HashResult(m_random.NextBytes(i));

                try
                {
                    uint h2 = h1.GetUInt();

                    if (i != 4)
                        Assert.Fail(i.ToString());

                    Assert.IsTrue(Converters.ConvertBytesToUInts(h1.GetBytes())[0] == h2, i.ToString());
                }
                catch
                {
                    if (i == 4)
                        Assert.Fail(i.ToString());
                }

                try
                {
                    ulong h3 = h1.GetULong();

                    if (i != 8)
                        Assert.Fail(i.ToString());

                    Assert.IsTrue(Converters.ConvertBytesToULongs(h1.GetBytes())[0] == h3, i.ToString());
                }
                catch
                {
                    if (i == 8)
                        Assert.Fail(i.ToString());
                }
            }
        }
Esempio n. 6
0
 public bool Equals(HashResult a_hashResult)
 {
     return SameArrays(a_hashResult.GetBytes(), m_hash);
 }