Warmed Up – picoCTF 2019

Challenge

What is 0x3D (base 16) in decimal (base 10).

Hint

Submit your answer in our competition’s flag format. For example, if you answer was ’22’, you would submit ‘picoCTF{22}’ as the flag.

Solution

Like Let’s Warm Up, this problem is similar and has multiple solutions that I will go through. First, we must understand that base 16 is hexadecimal and base 10 is decimal. Therefore we are looking for a hex to decimal conversion of “3D” to decimal. Keep in mind the 0x lead signifies the value is a hex value, and is not factored into any calculations.

Method 1: Online Converter

Again, RapidTables is a good site to use for a conversion this simple. It gives quite a bit of additional information as well.

Converting the hex can also be done by hand, by looking at an ASCII table:

Where 3D is found in the hex column, the decimal value is 61.

Method 2: Python

The Python method comes in handy when you’re already writing scripts in the language, or you want one of the quickest ways to convert. In Python3, you can simply type the literal hex value with the 0x indicator as such:

Python2 is the same command, just be aware that you have to use “print” if doing such from the console.

Method 3: Bash

Knowing how to use commands in bash is very helpful, especially when things like python may not be installed on the shell you’re working with. Here’s a quick look at a bash script that will take hex and convert it to decimal:

This uses C syntax to print 0x3D as the %d identifier, which is decimal in C.

Flag

The flag, in pico format, is picoCTF{61}



Previous: Lets Warm UpNext: 2Warm