2

I'm trying to do this

pack("<Q", 0x401a12)

It works as it is, but I need pack() to take string hex code

addr = "0x401a12" # some hex from dump
pack("<Q", addr)

Any help?

1
  • 1
    It is not Indian, it is endian (as in the "end"). Commented Feb 12, 2018 at 6:27

1 Answer 1

2

You can use int to convert to the corresponding integer:

struct.pack('<Q', int('0x401a12', base=16))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.