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.
public void Decode_Bad() { ExceptionAssert.Throws <FormatException>(() => Base58.Decode("jo91waLQA1NNeBmZKUF==")); }
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)); }
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())); }
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()); }
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)) { }