Skip to the content.

Base 64 & Color Codes HW

Popcorn Hacks (color codes)

  1. Which image format is best for logos and transparency?
    • PNG because PNG supports transparency and preserves image quality.
  2. Which format loses quality to make the file size smaller?
    • JPG/JPEG because JPEG uses lossy compression to shrink file size.
  3. Which format is used for simple animations, like memes?
    • GIF because GIF supports basic animations and limited color.

Popcorn Hack (base 64)

What does the Base64 string, U1Q= decode to?

  • U –> 20
  • 1 –> 53
  • Q –> 16
    (ignore padding for now)

Each base 64 character represents 6 bits. Here they are:

  • U (20) –> 010100
  • 1 (53) –> 110101
  • Q (16) –> 010000

Combine all bits into one string:

  • 010100 110101 010000 –> 010100110101010000

This gives us 18 bits, which represent 3 bytes (3 × 8 = 24 bits), but since there is one =, it indicates 1 byte of padding, meaning only 2 real bytes are encoded.

So we take the first 16 bits, split into 2 groups of 8 and convert to binary:

  • 01010011 01010100
  • 01010011 –> 83 –> ‘S’
  • 01010100 –> 84 –> ‘T’

Final Result:

ST

HW Hack 1 - Color Palette

HW Hack 2 (profile pic –> base 64)

pfp