Пример #1
0
        public void Can_successfully_decode_a_multihash_after_encoding_a_digest()
        {
            Prop.ForAll(Generators.ArbitraryHashFunction, Arb.From <NonEmptyString>(), (hashAlgorithm, nonEmptyString) =>
            {
                var digest = nonEmptyString.Get;
                byte[] characterEncodedDigest = new CharacterEncodedString(digest, Encoding.ASCII);
                var hash          = hashAlgorithm.Compute(characterEncodedDigest);
                var encodedDigest = hash.MultiHashEncode();
                var decodedDigest = MultiHash.Decode(encodedDigest);

                Assert.Equal(hash, decodedDigest);
            }).VerboseCheckThrowOnFailure();
        }