Sign in to follow this  
Followers 0
ken82m

Converting Stubborn REG_BINARY to String

8 posts in this topic

I'm converting all the binary strings in a reg string and of course the value I actually want is the one that won't convert.

In regedit it should me the value I expect, "TrueCryptVolZ".

But my output in scite is:

0x547275654372797074566F6C756D655A  -  ????????

Here's an example with the problem value

$varval = "0x547275654372797074566F6C756D655A"
$varconv = Binary($varval)
$varconv = BinaryToString($varconv, 2)
ConsoleWrite($varval & "  -  " & $varconv & @CRLF)

Thanks,

Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

The binary is already in binary format and is ansi text so the following works:

$varval = "0x547275654372797074566F6C756D655A"
$varconv = BinaryToString($varval, 1)
ConsoleWrite($varval & "  -  " & $varconv & @CRLF)

:)

Edit: Meh! Damn authenticity to be fast :party:

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

I haven't used those commands before, but am a little confused.

Shouldn't they be StringToHex() and HexToString() ?

Share this post


Link to post
Share on other sites

Hmm can be quite the same but it should be slower since it's working it way as a string a not as a byte array, might be wrong though ;].

Share this post


Link to post
Share on other sites

Oh, I see there already are a _StringToHex() and a _HexToString() function.

I guess BinaryToString() and _HexToString() are the same thing (except one expects the "0x" prefix and the other doesn't).

I was just confused about the "binary format", that makes me think of lots of 1's and 0's.

Share this post


Link to post
Share on other sites

I was just confused about the "binary format", that makes me think of lots of 1's and 0's.

Common mistake. Binary when it comes to software engineering almost never refers to true binary (one and zeros) but to hexadecimal numbers. Why? Because two hexidecimal numbers equals 1 byte, which is the minimum amount of addressable memory in a modern pc. In fact, even when programming directly to the cpu the instructions are encoded as hex.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Common mistake. Binary when it comes to software engineering almost never refers to true binary (one and zeros) but to hexadecimal numbers. Why? Because two hexidecimal numbers equals 1 byte, which is the minimum amount of addressable memory in a modern pc. In fact, even when programming directly to the cpu the instructions are encoded as hex.

I guess I'm locked into "old thinking". I've always thought of binary, octal, decimal, and hexadecimal as four disctinct methods of numeric representation. I guess I'll try to be less strict concerning the binary/hex verbage.

typo

(edit: although that explanation doesn't seem relevant)

Edited by Spiff59

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0