ken82m Posted May 23, 2009 Posted May 23, 2009 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."
Authenticity Posted May 23, 2009 Posted May 23, 2009 Dim $xBin = '0x547275654372797074566F6C756D655A' ConsoleWrite(BinaryToString($xBin) & @LF) You don't need to bin the binary form. :]
monoceres Posted May 23, 2009 Posted May 23, 2009 (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 Edited May 23, 2009 by monoceres Broken link? PM me and I'll send you the file!
Spiff59 Posted May 23, 2009 Posted May 23, 2009 I haven't used those commands before, but am a little confused. Shouldn't they be StringToHex() and HexToString() ?
Authenticity Posted May 23, 2009 Posted May 23, 2009 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 ;].
Spiff59 Posted May 23, 2009 Posted May 23, 2009 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.
monoceres Posted May 24, 2009 Posted May 24, 2009 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!
Spiff59 Posted May 24, 2009 Posted May 24, 2009 (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 May 24, 2009 by Spiff59
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now