I manage to convert but not via java.
I need string so I could get it easily using .net version NBitcoin and best 
part is that it is exactly same implementation as C++.


On Wednesday, May 2, 2018 at 9:11:36 AM UTC+8, Commentors-net wrote:
>
> In the code we have
>
>
> 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
>
> which is a difficulty bits for message
>
> The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
>
> can anyone provide a update what hashing or encoding is used to get that 
> string?
>
> I used
>
> String str = "The Times 03/Jan/2009 Chancellor on brink of second bailout 
> for banks";
> String ss = BaseEncoding.base16().lowerCase().encode(str.getBytes()));
>
> and output I have
>
> 5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
> whereas in code it has extra "04ffff001d010445"
>
> I am struggling to find that but failed so far.
>
> A help will be very much appreciated and my job will be saved :-)
>
> This is the output when I am decoding the string in code via
>
> byte[] bytes = Utils.HEX.decode( 
> "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73");
> String s = new String(bytes);
>
>
> Output is below:
>
>
>
> <https://lh3.googleusercontent.com/-IH6fJkwGJI8/WukQLiC5wCI/AAAAAAAAEXY/JRTuXE4qKHIvVFSrv2b9-kDpnx2TuoW9ACLcBGAs/s1600/decoding.PNG>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to