Day 10 - Get to Know Cryptography With CryptoHack
After diving into the theory of cryptography yesterday, today I decided to get my hands dirty. I signed up for CryptoHack, an amazing platform for learning and practicing modern cryptography through fun challenges.
I started with the "Introduction" section to get a feel for the platform and to refresh my basics on data encoding. Here's a recap of my journey!
1. Great snakes
The first challenge was a gentle warm-up, aptly named "Great snakes." The task was simply to run a Python script. Easy enough!
The flag I received was crypto{z3n_0f_pyth0n}
. This challenge seems to emphasize the importance of Python in the world of cryptography.
2. ASCII
Next up was the "ASCII" challenge. Data on computers is fundamentally just numbers. This challenge provided a list of numbers (ASCII values), and my task was to convert them back into readable text.
I wrote a short Python script to iterate through each number, convert it to its character representation using chr()
, and join them back together into a string.
After running the script, the flag appeared: crypto{ASCII_pr1nt4bl3}
.
3. Hex
Hexadecimal (hex) encoding is everywhere in the security world. It's a more human-readable way to represent binary data. This challenge gave me a long hex string to decode.
Fortunately, Python's bytes
object has a handy fromhex()
method that made this process very straightforward.
The result immediately produced the flag: b'crypto{You_will_be_working_with_hex_strings_a_lot}'
.
4. Base64
Base64 is another common encoding, especially for transmitting binary data over text-only channels like email or in URLs. This challenge was a puzzle solved via the command line.
The challenge provided a hex string. The trick was to first decode the hex back to its raw binary data, and then encode that result using Base64. The xxd
and base64
utilities in Linux were perfect for this.
This command yielded a flag with a slightly different format: crypto/Base+64+Encoding+is+Web+Safe/
.
5. Bytes and Big Integers
I used the powerful PyCryptodome
library in Python, specifically the long_to_bytes
function from Crypto.Util.number
, to solve this challenge in a single line.
And the flag for this section was: b'crypto{3nc0d1n6_4ll_7h3_w4y_d0wn}'
.
6. XOR Starter
The final challenge in the introduction block was about the eXclusive OR, or XOR operator. XOR is a fundamental bitwise operation in cryptography. As the challenge explained, it returns 0 if two bits are the same and 1 if they are different^
symbol
The task was to take the given string "label", and for each character, XOR its integer (Unicode) value with the integer 13
[97, 108, 111, 104, 97]
aloha
crypto{new_string}
, so the final flag is crypto{aloha}
.And that wraps up the "Introduction" section on CryptoHack! These were fun warm-up exercises covering the essential data representations I'll be seeing constantly in cryptography. It's a great way to bridge the gap between theory and practical application. On to the next challenges!
#IDNBootCampCyber
Komentar
Posting Komentar