<p>The reason you are getting a different address is because you are appending the same checksum that you got from using the <code>03</code> prefix to the new <code>prefix + payload</code>. You need to double hash the new <code>prefix + payload</code> and then append the first four bytes and then encode it in base58.</p>

<p>If I decode your result <code>MANDhrctLRAygo3dFckfWvEaWeQiti143C</code> to hexadecimal, I get <code>321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5020cb31b</code>. In this hexadecimal string, your prefix is <code>32</code>, payload is <code>1b0e61ac671bde7fb52e2f3d6e2dc213609d9de5</code>, and checksum is <code>020cb31b</code>.  </p>

<p>The checksum that you would get after double hashing the new <code>prefix + payload</code> is <code>e29f4248</code>. So, you should base58 encode <code>321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5e29f4248</code></p>

CC BY-SA 4.0
2019-04-02T11:38:59.733Z
2019-04-02T12:18:05.730Z
2019-04-02T12:18:05.730Z
Ugam Kamat
<p>Are there anyone know how to convert P2SH address (like <code>34A5PyCvPJKYtHmj9jmKhGzBBwpGuAkZog</code>) to <code>MANDhrctLRAygo3dFckfWvEaWeQizSwWNK</code>?</p>

<p>I tried to decode with <code>Base58Check</code>, then removed <code>05</code> and added  <code>032</code>, then encode it (<code>Base58Check</code>), however I got wrong result <code>MANDhrctLRAygo3dFckfWvEaWeQiti143C</code></p>

<litecoin><p2sh><p2pkh>
P2SH to LTC address with M
newbie
# P2SH to LTC address with M

(Asked by: username_0 on 2019-04-02)

Are there anyone know how to convert P2SH address (like `34A5PyCvPJKYtHmj9jmKhGzBBwpGuAkZog`) to `MANDhrctLRAygo3dFckfWvEaWeQizSwWNK`?

I tried to decode with `Base58Check`, then removed `05` and added `032`, then encode it (`Base58Check`), however I got wrong result `MANDhrctLRAygo3dFckfWvEaWeQiti143C`

**Tags:** litecoin, p2sh, p2pkh


---

## 1 answers

### Answer by username_1 on 2019-04-02. Score: 1 | Accepted answer

The reason you are getting a different address is because you are appending the same checksum that you got from using the `03` prefix to the new `prefix + payload`. You need to double hash the new `prefix + payload` and then append the first four bytes and then encode it in base58.

If I decode your result `MANDhrctLRAygo3dFckfWvEaWeQiti143C` to hexadecimal, I get `321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5020cb31b`. In this hexadecimal string, your prefix is `32`, payload is `1b0e61ac671bde7fb52e2f3d6e2dc213609d9de5`, and checksum is `020cb31b`.

The checksum that you would get after double hashing the new `prefix + payload` is `e29f4248`. So, you should base58 encode `321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5e29f4248`


---

