def decode(base58_val)
      int_val = 0
      base58_val.reverse.split(//).each_with_index do |char,index|
        raise ArgumentError, 'Value passed not a valid Base58 String.' if (char_index = ALPHABET.index(char)).nil?
        int_val += char_index * (SIZE ** index)
      end
      s = int_val.to_even_length_hex
      s = '' if s == '00'
      leading_zero_bytes = (base58_val.match(/^([1]+)/) ? $1 : '').size
      s = ('00' * leading_zero_bytes) + s if leading_zero_bytes > 0
      s
    end
def decode(base58_val)
      int_val = 0
      base58_val.reverse.split(//).each_with_index do |char,index|
        raise ArgumentError, 'Value passed not a valid Base58 String.' if (char_index = ALPHABET.index(char)).nil?
        int_val += char_index * (SIZE ** index)
      end
      s = int_val.to_even_length_hex
      s = '' if s == '00'
      leading_zero_bytes = (base58_val.match(/^([1]+)/) ? $1 : '').size
      s = ('00' * leading_zero_bytes) + s if leading_zero_bytes > 0
      s
    end
decode base58 string to hex value.