Description
If I told you a word was 0x70 in hexadecimal, could you tell me what it is in ASCII?
Solution
- Step 1Convert hex to ASCII with Python0x70 in hex equals 112 in decimal. Python's chr() converts any integer to its corresponding ASCII/Unicode character. chr(0x70) returns 'p', which is the flag contents.python3 -c "print(chr(0x70))"
Learn more
Hexadecimal (base 16) uses digits 0–9 and letters A–F to represent values 0–15 in a single character. The prefix
0xsignals a hex literal in most programming languages. A single hex digit represents 4 bits (a nibble), so two hex digits represent one byte (8 bits). This makes hex the standard notation for raw byte values -- you will see it everywhere in binary exploitation, network protocols, and cryptography.ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding standard that maps integers 0–127 to characters. The printable range is 32–126. Key landmarks to memorize:
- 0x41–0x5A (65–90) = uppercase A–Z
- 0x61–0x7A (97–122) = lowercase a–z
- 0x30–0x39 (48–57) = digits 0–9
- 0x20 (32) = space, 0x0A (10) = newline, 0x00 (0) = null terminator
Python's
chr()andord()functions are the primary tools for converting between integers and characters.chr(0x70)gives'p';ord('p')gives112. For converting a sequence of hex bytes to a string, usebytes.fromhex('70696e67').decode(). Understanding the relationship between hex values and ASCII is essential for reading disassembly, interpreting network captures, and debugging binary formats.
Flag
picoCTF{...}
Hexadecimal 0x70 = decimal 112 = ASCII 'p'. Python's chr() converts any integer to its ASCII/Unicode character.