<p>Your output is correct given the input that you used.</p>

<p>However, If you are expecting to get an output address of <code>39YteymR86cG7V3Kijg8Gm2ST1r4nTeM1b</code>, it looks like your input is incorrect. It's missing the first byte and the last 4 bytes (encoded as hex):</p>

<pre><code>  Your Input: --56379c7bcd6b41188854e74169f844e8676cf8b8--------
Proper Input: 0556379c7bcd6b41188854e74169f844e8676cf8b86e1b34ba
</code></pre>

<hr>

<h2><a href="http://lenschulwitz.com/base58" rel="nofollow noreferrer">Try this tool for validating your expectations</a>:</h2>

<p><a href="https://i.sstatic.net/2cxPV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2cxPV.png" alt="Example Form"></a></p>

CC BY-SA 3.0
2017-12-29T18:51:53.473Z
Thanks! From where did you know I need do add 05 and 6e1b34ba?
A.c
CC BY-SA 3.0
2017-12-29T19:03:49.517Z
I dont know the address before. I only know the String which has then to be base58-encoded to show me the address.
A.c
CC BY-SA 3.0
2017-12-29T19:44:32.927Z
@A.c From the site that I linked to in my answer. I reversed your expected output.
Ryan McGeary
CC BY-SA 3.0
2017-12-29T18:38:50.367Z
2017-12-30T01:12:03.647Z
2017-12-30T01:12:03.647Z
Ryan McGeary
<p>I would like to Base58-encode this String:</p>

<pre><code>    56379c7bcd6b41188854e74169f844e8676cf8b8
</code></pre>

<p>My current Java code looks like this:</p>

<pre><code>    String test9 = "56379c7bcd6b41188854e74169f844e8676cf8b8";
    byte[] b2 = new BigInteger(test9,16).toByteArray();
    String test8 = Base58.encode(b2);
    System.out.println(test8);
</code></pre>

<p>As result I get:</p>

<pre><code>    2CffxtJsCdzJEaHXHjSkvb12p12P
</code></pre>

<p>but I should get:</p>

<pre><code>    39YteymR86cG7V3Kijg8Gm2ST1r4nTeM1b
</code></pre>

<p>Can someone help me, please?</p>

CC BY-SA 4.0
2021-06-11T19:16:50.320Z
@Ryan_McGeary What is the library that you got access to Base58 class? I like to know.
Lakshitha Kanchana
<address><multi-signature><java><base58>
Java: Base58-encode String
A.c
# Java: Base58-encode String

(Asked by: username_0 on 2017-12-29)

I would like to Base58-encode this String:

```
    56379c7bcd6b41188854e74169f844e8676cf8b8

```

My current Java code looks like this:

```
    String test9 = "56379c7bcd6b41188854e74169f844e8676cf8b8";
    byte[] b2 = new BigInteger(test9,16).toByteArray();
    String test8 = Base58.encode(b2);
    System.out.println(test8);

```

As result I get:

```
    2CffxtJsCdzJEaHXHjSkvb12p12P

```

but I should get:

```
    39YteymR86cG7V3Kijg8Gm2ST1r4nTeM1b

```

Can someone help me, please?

**Tags:** address, multi-signature, java, base58

> **Comments:**
> **username_1**: @username_2 What is the library that you got access to Base58 class? I like to know.  

---

## 1 answers

### Answer by username_2 on 2017-12-29. Score: 4 | Accepted answer

Your output is correct given the input that you used.

However, If you are expecting to get an output address of `39YteymR86cG7V3Kijg8Gm2ST1r4nTeM1b`, it looks like your input is incorrect. It's missing the first byte and the last 4 bytes (encoded as hex):

```
  Your Input: --56379c7bcd6b41188854e74169f844e8676cf8b8--------
Proper Input: 0556379c7bcd6b41188854e74169f844e8676cf8b86e1b34ba

```

---

## [Try this tool for validating your expectations](http://lenschulwitz.com/base58):

[![Example Form](https://i.sstatic.net/2cxPV.png)](https://i.sstatic.net/2cxPV.png)

> **Comments:**
> **username_0**: Thanks! From where did you know I need do add 05 and 6e1b34ba?  
> **username_0**: I dont know the address before. I only know the String which has then to be base58-encoded to show me the address.  
> **username_2**: @username_0 From the site that I linked to in my answer. I reversed your expected output.  

---

