Jump to content
Sign in to follow this  
qwer85

Rotate binary

Recommended Posts

qwer85

I have a binary:

0xDCF5E801

how to convert it, so I will get this:

0x01E8F5DC

I have done it by following script:

$tmp = BinaryToString($binary)
$new_binary = StringToBinary(StringMid($tmp, 4, 1) & StringMid($tmp, 3, 1) & StringMid($tmp, 2, 1) & StringMid($tmp, 1, 1))

is there any way to simplify this script?

Thanks.

Edited by qwer85

Share this post


Link to post
Share on other sites
The Kandie Man

I have a binary 0xDCF5E801 how to convert it, so I will get this 0x01E8F5DC.

Thanks.

Your question is analagous to the following:

I have 5,697,476. How do I make it -3?

Please elaborate on exactly you want done in order to make 0xDCF5E801 0x01E8F5DC.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites
qwer85

pls look at the modified first post

The difference between those numbers is that each two bytes are grouped in "words" and there is a back order of those "words".

Edited by qwer85

Share this post


Link to post
Share on other sites
qwer85

I'm trying to implement searching the value in memory by pointer, can someone explain me why this happens?

When i use foll script (with pointer search):

$v_Read = _MemRead($v_Open, 0x01D2AE53, 4)
$tmp = Binary(BitRotate(String($v_Read), 32, "D"))
ConsoleWrite($tmp & @CRLF)
$v_Read = _MemRead($v_Open, $tmp, 5)
ConsoleWrite($v_Read & @CRLF)oÝ÷ Ú(¶Øb²)Ü¢{(ç(1ÓQ

It gives me the right result:

0x01E8F5DC
0x616C696173

Share this post


Link to post
Share on other sites
Siao

Well, looks like _MemRead function doesn't like Autoit's Binary data type as an argument.

Try Dec(Hex(Binary(BitRotate(String($v_Read), 32, "D")))).

Although TBH this conversion is turning from extravagant to ridiculous quite fast :)

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
qwer85
Dec(Binary(BitRotate(String($v_Read), 32, "D"))) returns 0

Share this post


Link to post
Share on other sites
Siao

don't skip that Hex()


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
qwer85

don't skip that Hex()

hoh, you are genious, man :)

thanks again.

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  

×