public void ComputeHash_AMillionATest()
        {
            byte[] actualHash   = Ripemd160Fo.ComputeHash_Static(HashTestCaseHelper.GetAMillionA());
            byte[] expectedHash = Helper.HexToBytes("52783243c1697bdbe16d37f97f68f08325dc1528");

            Assert.Equal(expectedHash, actualHash);
        }
        public void ComputeHash_ReuseTest()
        {
            // From https://en.wikipedia.org/wiki/RIPEMD#RIPEMD-160_hashes
            byte[] msg1 = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog");
            byte[] msg2 = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy cog");
            byte[] exp1 = Helper.HexToBytes("37f332f68db77bd9d7edd4969571ad671cf9dd3b");
            byte[] exp2 = Helper.HexToBytes("132072df690933835eb8b6ad0b77e7b6f14acad7");

            byte[] act1 = Ripemd160Fo.ComputeHash_Static(msg1);
            byte[] act2 = Ripemd160Fo.ComputeHash_Static(msg2);

            Assert.Equal(exp1, act1);
            Assert.Equal(exp2, act2);
        }
 public void ComputeHash_ProgressiveTest(byte[] message, byte[] expectedHash)
 {
     byte[] actualHash = Ripemd160Fo.ComputeHash_Static(message);
     Assert.Equal(expectedHash, actualHash);
 }
Example #4
0
 private static byte[] ComputeHash160(byte[] data)
 {
     using System.Security.Cryptography.SHA256 sha = System.Security.Cryptography.SHA256.Create();
     return(Ripemd160Fo.ComputeHash_Static(sha.ComputeHash(data)));
 }