Lets Warm Up picoCTF 2019 Solution

Published: April 2, 2026

Description

If I told you a word was 0x70 in hexadecimal, could you tell me what it is in ASCII?

  1. Step 1Convert hex to ASCII with Python
    0x70 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.
    python
    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 0x signals 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() and ord() functions are the primary tools for converting between integers and characters. chr(0x70) gives 'p'; ord('p') gives 112. For converting a sequence of hex bytes to a string, use bytes.fromhex('70696e67').decode(). Understanding the relationship between hex values and ASCII is essential for reading disassembly, interpreting network captures, and debugging binary formats.

    Beyond Python, there are many quick ways to perform ASCII lookups in a terminal. The command printf '%d\n' '''p prints the decimal value of a character in bash. The man ascii page on most Unix systems displays a full ASCII table organized by decimal, octal, and hex values side by side - a useful reference to keep open during binary challenges. Online tools like CyberChef's "From Charcode" operation handle bulk conversions when you have many bytes to decode at once.

    Extended ASCII and Unicode are important extensions to understand as well. Standard ASCII only covers 128 code points (0-127). Extended ASCII encodings like Latin-1 (ISO-8859-1) added a second block of 128 characters (128-255) covering accented European letters. Modern systems use Unicode (UTF-8 encoding), which is backward-compatible with ASCII for the first 128 code points but extends far beyond. In binary exploitation, off-by-one errors between ASCII and Unicode assumptions can cause real security bugs, such as when byte values above 127 are interpreted differently depending on which encoding a program assumes.

    In CTF competitions, single hex-byte-to-ASCII conversions like this challenge are intentionally trivial to teach the fundamental mechanics. The same skill scales up directly: shellcode is written as hex bytes (\x70\x6c\x61\x79), network protocol dissection involves identifying fields by their hex values, and format string attacks manipulate ASCII control characters. Memorizing the key ranges - uppercase letters start at 0x41, lowercase at 0x61, digits at 0x30 - makes these tasks significantly faster in timed competitions.

Alternate Solution

Use the Binary to Hex tool on this site to look up hex 0x70 and instantly see its ASCII character - no Python or command line needed.

Flag

picoCTF{...}

Hexadecimal 0x70 = decimal 112 = ASCII 'p'. Python's chr() converts any integer to its ASCII/Unicode character.

Want more picoCTF 2019 writeups?

Useful tools for General Skills

Related reading

What to try next