예제 #1
0
        public void TestDecode(string hex, int code, string name)
        {
            var ob = Hex.Decode(hex);
            var nb = Binary.Varint.GetBytes((uint)code).Concat(Binary.Varint.GetBytes((uint)ob.Length)).Concat(ob).ToArray();

            var dec = Multihash.Decode(nb);

            Assert.Equal((int)dec.Code, code);
            Assert.Equal(dec.Name, name);
            Assert.Equal(dec.Length, ob.Length);
            Assert.Equal(dec.Digest, ob);
        }
예제 #2
0
 public override void Decode(byte[] bytes) => Value = Multihash.Decode(bytes);