public static BigInteger DecodeToBigInteger(string input)
{
var bi = BigInteger.ValueOf(0);
// Work backwards through the string.
for (var i = input.Length - 1; i >= 0; i--)
{
var alphaIndex = _alphabet.IndexOf(input[i]);
if (alphaIndex == -1)
{
throw new AddressFormatException("Illegal character " + input[i] + " at " + i);
}
bi = bi.Add(BigInteger.ValueOf(alphaIndex).Multiply(_base.Pow(input.Length - 1 - i)));
}
return bi;
}