Convert hex data values from streams

+1 vote
How to convert the hexadecimal values from Streams to strings data.

asked Mar 16, 2017 by saravana

1 Answer

0 votes
Best answer
Thanks, i have figured out...

it's bin2hex() and hex2bin() in PHP.
answered Mar 16, 2017 by saravana
Can we do it on multichain side...?
No, unfortunately not, because you cannot pass binary data in JSON.
so for example i am doing stream and getting the transaction. no i have to read what i stream.. so how its possible..

what i tried so far:
From transaction i can get the hash and from hash i am getting hex data.. not convert the hex data into ASCII its not possible on BC side..

So in which way we can get the stream data into back to ASCII form.. at BC Side
You should convert the data to ASCII on the client side.

Or use MultiChain 2.0 alpha 3 which provides native support for text items in streams.
Any sample code or any example. its possible for you to share.. ?
To convert between hexadecimal and text in PHP, use the pack() and unpack() functions. Here's the code you need: