Jump to content

Convert String to Hex with options ?


Who
 Share

Recommended Posts

#include <string.au3>
$String = "I like AutoIt3"
$Hex = _StringToHex($String)
MsgBox(0, "Hex", "Original String: " & $String & @LF & " Hex: " & $Hex)

If I have this code, then the result will be "49206C696B65204175746F497433" which is the "AutoIt3" is converted to "4175746F497433". But If I don't want to get this result "4175746F497433", how can I change to another hex ? Thanks.

Link to comment
Share on other sites

If you don't want that result, don't run the script... :)

All seriousness aside, you didn't say what you DO want it to do.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

... $String = "I like AutoIt3" ... the result will be "49206C696B65204175746F497433" .... "AutoIt3" is ... "4175746F497433". But If I don't want to get this result "4175746F497433", how can I change to another hex ?

If you explain what your end goal is, that will help us know if you are heading in the right direction. If you're wanting to take a Hex value and covert it to a string value, then you'd use _HexToString(). This of course will not take an encrypted hex value and give you its unencrypted string. If you only want the "49206C696B65" to be your result then you can use StringTrimRight() or any of the other String...() functions to parse the information you what.

Unfortunately it's not clear what you mean by "how can I change to another hex?" Unless you want the script to replace "4175746F497433" with another hex value like "4D6963726F736F6674" so that your _HexToString() value would be "I like Microsoft". If that's what you're trying to do, then read up on StringLeft(), StringReplace(), and possibly _StringBetween(). To PsaltyDS' earlier point, what do you want?

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