4

bytes sig = hex"aca7da" and bytes sig = "\xac\xa7\xda" seem to be the same thing, ASCII interpreted as hex. Does the format "\xFF\xFF\xFF" somehow code that it should be read as hex?

1 Answer 1

5

the \xNN notation is used to express hexadecimal like in Javascript(Hexadecimal escape sequences).

The provided forms are the same to represent the value of :0xaca7da

Difference :

\x could be used to express a special hex(initial form) value within a string e.g : "aca7\xd4" which is in asci will be converted to hex 0x61636137da so 'da' keeps its form(not considered as a string).However, hex"" will consider the whole string in the hex form.

1
  • I think you should fix it thus: will be converted to hex 0x61636137d4 so d4 keeps... Commented Jan 31, 2017 at 12:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.