<p>You can do it by decoding address from base58 then spliting it in version bit and payload and then assemble it into cashAddress and calculate checksum or if you want there is another project on github that claims to do that <a href="https://github.com/Har01d/CashAddressPHP" rel="nofollow noreferrer">Har01d/CashAddressPHP</a> maybe you should git it a try</p>

CC BY-SA 3.0
2018-01-17T09:42:43.713Z
2018-01-17T09:42:43.713Z
Oskyk
<p>I've been trying with <a href="https://github.com/btccom/cashaddress-php/tree/master/examples" rel="nofollow noreferrer">cashaddress-php</a> but it doesn't work because the address should be in hex format, I tried with hex public hash key it also didn't work.</p>

<blockquote>
<pre><code>Invalid hash length [320 bits] for pubkeyhash
</code></pre>
</blockquote>

<p>Is there's any way to convert legacy bitcoin-cash address to copay(cashAddr)?</p>

<p><a href="https://bitpay.github.io/address-translator/" rel="nofollow noreferrer">Live example</a></p>

<bitcoin-cash><address-generation>
How to convert Bitcoin cash address to cashAddress Format in PHP?
Tailer
# How to convert Bitcoin cash address to cashAddress Format in PHP?

(Asked by: username_0 on 2018-01-15)

I've been trying with cashaddress-php but it doesn't work because the address should be in hex format, I tried with hex public hash key it also didn't work.

Invalid hash length [320 bits] for pubkeyhash


Is there's any way to convert legacy bitcoin-cash address to copay(cashAddr)?
Live example

**Tags:** bitcoin-cash, address-generation


---

## 1 answers

### Answer by username_1 on 2018-01-17. Score: 3 | Accepted answer

You can do it by decoding address from base58 then spliting it in version bit and payload and then assemble it into cashAddress and calculate checksum or if you want there is another project on github that claims to do that [Har01d/CashAddressPHP](https://github.com/Har01d/CashAddressPHP) maybe you should git it a try


---

