 
 #=====================================================================
 
-console.log std_encoding.encode new Buffer [0...300]+encoded = std_encoding.encode new Buffer [0...300]
+console.log encoded
+decoded = std_encoding.decode encoded
+console.log decoded
+console.log decoded.toString 'hex'
        out += Math.ceil(rem*8/@log58)
      out

#=====================================================================

class Foo

  decode: (str) ->
    num = BigInteger.ZERO
    base = BigInteger.ONE
    i = 0
    for c,i in str
      break unless c is @alphabet[0]
    start = i
    pad = new Buffer (0 for i in [0...start])
    for c,i in str[start...] by -1
      unless (char_index = @lookup[c])?
        throw new Error('Value passed is not a valid BaseX string.')
      num = num.add base.multiply nbv char_index
      base = base.multiply @basebn
    Buffer.concat [pad, new Buffer(num.toByteArray()) ]

#=====================================================================


    if @alphabet.length isnt @base
      throw new Error "Encoder alphabet length must be 58 chars"
    @decode_map = {}
    for a,i in (new Buffer @alphabet, 'utf8')
      @decode_map[a] = i

  # encoder a buffer of binary data into a base58-string encoding
