A codec for IPFS Base-58.

A codec for Base-58, Encode and Decode. Adds the extension method ToBase58 to encode a byte array and FromBase58 to decode a Base-58 string.

This is just thin wrapper of .

This codec uses the BitCoin alphabet not Flickr's.

示例#1
0
 public void Decode_Bad()
 {
     ExceptionAssert.Throws <FormatException>(() => Base58.Decode("jo91waLQA1NNeBmZKUF=="));
 }
示例#2
0
 public void Zero()
 {
     Assert.AreEqual("1111111", Base58.Encode(new byte[7]));
     Assert.AreEqual(7, Base58.Decode("1111111").Length);
     Assert.IsTrue(Base58.Decode("1111111").All(b => b == 0));
 }
示例#3
0
 public void Decode()
 {
     Assert.AreEqual("this is a test", Encoding.UTF8.GetString(Base58.Decode("jo91waLQA1NNeBmZKUF")));
     Assert.AreEqual("this is a test", Encoding.UTF8.GetString("jo91waLQA1NNeBmZKUF".FromBase58()));
 }
示例#4
0
 public void Encode()
 {
     Assert.AreEqual("jo91waLQA1NNeBmZKUF", Base58.Encode(Encoding.UTF8.GetBytes("this is a test")));
     Assert.AreEqual("jo91waLQA1NNeBmZKUF", Encoding.UTF8.GetBytes("this is a test").ToBase58());
 }
示例#5
0
 public void Decode_Bad()
 {
     ExceptionAssert.Throws <InvalidOperationException>(() => Base58.Decode("jo91waLQA1NNeBmZKUF=="));
 }
 public override string ToString()
 {
     return(Base58.Encode(Value));
 }
 public MultiHash(string base58) : this(Base58.Decode(base58))
 {
 }