Matches() public method

Determines if the stream data matches the hash.
Matches is used to ensure data integrity.
public Matches ( Stream data ) : bool
data Stream /// The containing the data to check. ///
return bool
Beispiel #1
0
        public void Wire_Formats()
        {
            var hashes = new[]
            {
                "5drNu81uhrFLRiS4bxWgAkpydaLUPW",                                                             // sha1
                "QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4",                                             // sha2_256
                "8Vtkv2tdQ43bNGdWN9vNx9GVS9wrbXHk4ZW8kmucPmaYJwwedXir52kti9wJhcik4HehyqgLrQ1hBuirviLhxgRBNv", // sha2_512
            };
            var helloWorld = Encoding.UTF8.GetBytes("hello world");

            foreach (var hash in hashes)
            {
                var mh = new MultiHash(hash);
                Assert.IsTrue(mh.Matches(helloWorld), hash);
            }
        }