Description
What is 0x3D (hexadecimal) in decimal?
Solution
- Step 1Convert hex to decimal with Python0x3D breaks down as 3*16 + 13 = 61. Python's int() with base 16 converts hex strings directly: int('0x3D', 16) returns 61.python3 -c "print(int('0x3D', 16))"
Learn more
Hexadecimal (base 16) is the number system most commonly used in computing and security. It uses sixteen digits: 0-9 for values 0-9, and A-F (or a-f) for values 10-15. The prefix
0xis the conventional way to indicate a hexadecimal number in source code and shell environments.Converting hex to decimal manually: multiply each digit by its positional power of 16 and sum the results. For
0x3D: the digit3is in the 16's place (3 × 16 = 48), and the digitD(= 13) is in the 1's place (13 × 1 = 13). Sum: 48 + 13 = 61.Why hexadecimal matters in security:
- Each hex digit represents exactly 4 bits (a nibble), so 2 hex digits = 1 byte
- Memory addresses, opcodes, file offsets, and color codes are all conventionally written in hex
- Hash values (MD5, SHA-256) and cryptographic keys are displayed as hex strings
- Network packets and binary file formats are analyzed in hex editors
Python's
int(x, base)function converts any string to an integer in the given base. Similarly,hex(n)converts an integer to its hex string,bin(n)gives binary, andoct(n)gives octal. For quick conversions in the shell,printf '%d\n' 0x3Dorecho $((16#3D))both work without Python.
Flag
picoCTF{...}
0x3D = 3*16 + 13 = 61. Python's int(x, 16) converts hex strings to decimal.