Esempio n. 1
0
        public void TestEd25519Seed(string base58)
        {
            var bytes = new byte[19];

            Base58Check.ConvertFrom(base58, bytes);
            Assert.Equal(base58, Base58Check.ConvertTo(bytes));
        }
Esempio n. 2
0
        public void TestSecp256k1Seed(string base58)
        {
            var bytes = new byte[17];
            var count = Base58Check.ConvertFrom(base58, bytes);

            Assert.Equal(count, bytes.Length);
            Assert.Equal(base58, Base58Check.ConvertTo(bytes));
        }
Esempio n. 3
0
        public void TestAccount(string base58)
        {
            var bytes = new byte[21];
            var count = Base58Check.ConvertFrom(base58, bytes);

            Assert.Equal(count, bytes.Length);
            Assert.Equal(base58, Base58Check.ConvertTo(bytes));
        }
Esempio n. 4
0
 public Property TestRoundTrip()
 {
     return(Prop.ForAll(
                Arb.From <byte[]>(),
                bytes =>
     {
         var base58 = Base58Check.ConvertTo(bytes);
         // Oversize the buffer
         var result = new byte[bytes.Length + 8];
         var count = Base58Check.ConvertFrom(base58, result);
         // trim to decoded size
         result = result.AsSpan().Slice(0, count).ToArray();
         Assert.Equal(bytes.Length, count);
         Assert.Equal(bytes, result);
     }));
 }