Author

Topic: .................... (Read 177 times)

full member
Activity: 198
Merit: 130
Some random software engineer
April 23, 2018, 01:02:30 AM
#6
i mean this

v� H�' !�E l;O�q "��

well.. i have something like this and i want to convert it to base64..
how can i do it ?


This is the transaction output script, which is given in its humanly readable format as well on the same page:

Quote
OP_DUP OP_HASH160 489ac8dd2713218545056c3b4fb0710522aeee0d OP_EQUALVERIFY OP_CHECKSIG

In its hex form:

Quote
76 a9 489ac8dd2713218545056c3b4fb0710522aeee0d 88 ac
(Values taken from https://en.bitcoin.it/wiki/Script

Why would you want to convert it in base64 ?

By the way:

Code:
$ echo -n "76a9489ac8dd2713218545056c3b4fb0710522aeee0d88ac" | xxd -r -p | base64
dqlImsjdJxMhhUUFbDtPsHEFIq7uDYis

$ echo -n dqlImsjdJxMhhUUFbDtPsHEFIq7uDYis | base64 -d | xxd
00000000: 76a9 489a c8dd 2713 2185 4505 6c3b 4fb0  v.H...'.!.E.l;O.
00000010: 7105 22ae ee0d 88ac                      q.".....
sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
April 22, 2018, 08:05:44 PM
#5
.

What are you trying to do with the script?
The blockchair.com explorer does that by default.

@OP:
It tries to convert hash160 of bitcoin addresses to ASCII string for cases where people encode data in the blockchain by using "fake" bitcoin addresses.
For example if you view this 'fake' address 17xws5ASGc1dpKYB6jBRnRJGEKEQ4Xq7fy on Blockchair block explorer it will automatically convert the hash160 of the address 4c656e20776173206f757220667269656e642e20 to
Quote
Len was our friend

If it tries to decode that of a "real" bitcoin address then it will rightly output gibberish, as you can see in your address.
staff
Activity: 3458
Merit: 6793
Just writing some code
April 22, 2018, 06:13:25 PM
#4
A script is a sequence of bytes that gives instructions to the script interpreter. It is not human readable data and attempting to interpret the raw bytes as text as you have done will result in garbage (which is what you are seeing). Typically people examine scripts encoded in hexadecimal or they decode the script into text that represent the opcodes and data provided in the script. The data is usually in hex.

What are you trying to do with the script?
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
April 22, 2018, 06:08:02 PM
#3
The script?

It's the binary of the script as far as I can gather (the script is the field above).


i mean this

v� H�' !�E l;O�q "��


well.. i have something like this and i want to convert it to base64..

how can i do it ?

You can't I don't think. As far as I know "�" is a wildcard that is used when a program can't understand stuff so that might make it impossible to convert it.

Where is your string stored that you want to convert, what is it? Can you send it me.

I can write a quick program to convert something like that if you're interested. You just need to convert every character to string and understand that every character takes up 128 bits and make a string from there.

For example, a simple string like ABC.
Would make A=65, B=66, C=67.
This could then be converted to a long string of:
01000001    01000010    01000011

This would apparently give a decimal value of: 4276803 ("apparently" - because I used an online converter instead).
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
April 22, 2018, 05:18:57 PM
#2
The script?

It's the binary of the script as far as I can gather (the script is the field above).
newbie
Activity: 6
Merit: 0
April 22, 2018, 05:03:59 PM
#1
.........................................
Jump to: