binhexa

Published: April 3, 2024

Description

How well can you perfom basic binary operations?

Additional details will be available after launching your challenge instance.

Port provided per instance

Launch the picoCTF instance so it assigns you a unique port number for your session.

Connect to titan.picoctf.net with that port via netcat to receive the randomized prompts.

nc titan.picoctf.net <PORT_FROM_INSTANCE>

Solution

  1. Step 1Understand the challenge
    Each run gives a series of six questions that perform operations on two binary numbers. The values below are from one walkthrough; your connection will use different operands. Use the Binary Calculator tool for most of these conversions since it handles AND/OR/XOR, addition, and bit shifts without mistakes.
    Learn more

    Binary is base-2 notation - numbers are represented using only the digits 0 and 1. Every bit position represents a power of 2 (1, 2, 4, 8, 16, ...), just as every digit in decimal represents a power of 10. Understanding binary arithmetic is foundational to all of computing: CPUs operate in binary at the hardware level, and bitwise operations are used everywhere from networking (subnet masks) to cryptography (XOR ciphers) to data compression.

    The six operations in this challenge cover the core bitwise and arithmetic operations:

    • AND (&) - outputs 1 only when both input bits are 1. Used for masking: isolating specific bits by ANDing with a mask.
    • OR (|) - outputs 1 when at least one input bit is 1. Used for setting bits: forcing specific positions to 1.
    • Left shift (<<) - shifts all bits left by N positions, appending zeros on the right. Equivalent to multiplying by 2^N.
    • Right shift (>>) - shifts all bits right by N positions, discarding the rightmost bits. Equivalent to integer division by 2^N.
    • Addition (+) - standard binary addition with carry propagation, identical in principle to decimal addition.
    • Multiplication (*) - binary long multiplication; equivalent to repeated addition and shifting.

    The final step asks you to convert the result to hexadecimal. Hex(base-16) is a compact representation of binary: each hex digit maps exactly to 4 binary bits (a "nibble"). Programmers use hex because it is far more readable than long binary strings - a 32-bit value needs 32 binary digits but only 8 hex digits.

  1. Compute 11010100 & 00100001

    Answer: 00000000

    Any overlapping 1 bits survive the AND; otherwise the result bit is 0.

  2. Compute 11010100 | 00100001

    Answer: 11110101

    OR preserves 1s from either operand. RapidTables' binary calculator makes this trivial.

  3. Multiply 11010100 * 00100001

    Answer: 1101101010100

    Binary multiplication mirrors base-10 long multiplication: stack the numbers and shift addends.

  4. Shift 11010100 left by 1 bit

    Answer: 110101000

    Appending a single 0 on the right multiplies the number by two.

  5. Compute 11010100 + 00100001

    Answer: 11110101

    Binary addition carries just like decimal math, so watch the carry chain in the middle bits.

  6. Shift 00100001 right by 1 bit

    Answer: 10000

    A right shift divides by two, chopping the least-significant bit.

Helpful resources

Related guides

Flag

picoCTF{b1tw^3se_0p3eR@tI0n_su33essFuL_aea...}

After answering all six prompts correctly, the service asks for the hexadecimal form of the final value (10000₂ = 0x10). Submit that answer to receive the flag above.

Want more picoCTF 2024 writeups?

Tools used in this challenge

Related reading

Do these first

What to try next