Jump to content

Converting Stubborn REG_BINARY to String


Recommended Posts

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

 "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."

Link to comment
Share on other sites

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!

Link to comment
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.

Link to comment
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!

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...