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=="));
 }
예제 #6
0
 public override string ToString()
 {
     return(Base58.Encode(Value));
 }
예제 #7
0
 public MultiHash(string base58) : this(Base58.Decode(base58))
 {
 }