RSSAmplifier

Nathan Ellison · Aug 11, 2024

Base64 - 10 points

0
Sign in to vote or save

Nathan Ellison

Challenge Description

Another common encoding scheme is Base64, which allows us to represent binary data as an ASCII string using an alphabet of 64 characters. One character of a Base64 string encodes 6 binary digits (bits), and so 4 characters of Base64 encode three 8-bit bytes.

Base64 is most commonly used online, so binary data such as images can be easily included into HTML or CSS files.

Take the below hex string, decode it into bytes and then encode it into Base64.

72bca9b68fc16ac7beeb8f849dca1d8a783e8acf9679bf9269f7bf

Solution

Using the fromhex() and b64encode() functions (in that order) transform the data into the required format.

1# don't name this file base64.py or you're going to get a circular import error
2
3import base64
4
5hex_flag='72bca9b68fc16ac7beeb8f849dca1d8a783e8acf9679bF9269f7bf'
6byte_flag=bytes.fromhex(hex_flag)
7encoded_flag=base64.b64encode(byte_flag)
8print(encoded_flag.decode())

Flag: crypto/Base+64+Encoding+is+Web+Safe/

Read the original on nathan-ellison.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.