🏳️
Bag of Flags
  • Home
  • 2023
    • 🅿️picoCTF 2023
      • money-ware
      • repetitions
      • two-sum
      • ReadMyCert
      • rotation
      • hideme
      • PcapPoisoning
      • who is it
      • Reverse
      • timer
      • Safe Opener 2
      • findme
      • MatchTheRegex
      • SOAP
    • 🐦magpieCTF 2023
      • Space Plan
      • Space Exploration
      • So Meta
      • There is no flag
      • Momma says to play fair
      • Rubis
      • What is the password?
      • Eavesdropper
      • Shredded
      • Missing Flag
      • This outta be large enough right?
      • No Password Here
      • Chocolate Chips with Zero-G
      • Education Comes First
    • 🌴ISSessions CTF 2023
      • Basic Permissions
      • Crack Me
      • File Detective
      • Word Vomit
      • Fileception
      • Coding Time
      • Ghost File
      • CryptoTools1
      • CryptoTools2
      • 1337
      • ROT++
      • RunedMyDay
      • RSA_2
      • The Man Who Sold the World
      • VaultChallenge
      • Lost Media
      • Decontamination
      • Decade Capsule
      • Password in A Haystack
  • 2022
    • 🏁UW CTF S22
      • 0s and 1s
      • simple image
      • Helikopter
      • Meow
      • Google Form
      • Strings, literally
      • WASM
      • Audio
      • Pwn0
      • YATD
      • steg
      • Passwords
      • Vitalik
  • Practice
    • 🧠CryptoHack
      • Introduction
        • Finding Flags
        • Great Snakes
      • General
        • ASCII
        • Hex
        • Base64
        • Bytes and Big Integers
        • XOR Starter
        • XOR Properties
        • Favourite byte
        • You either know, XOR you don't
        • Greatest Common Divisor
Powered by GitBook
On this page
  • Description
  • I don't know
  • Flag
  1. Practice
  2. CryptoHack
  3. General

You either know, XOR you don't

Description

I've encrypted the flag with my secret key, you'll never be able to guess it. Remember the flag format and how it might help you in this challenge! 0e0b213f26041e480b26217f27342e175d0e070a3c5b103e2526217f27342e175d0e077e263451150104

I don't know

What I do know is that the flag format is crypto{...}, which we can try using

Recall due to associativity, flag ^ key = cipher means cipher ^ flag = key

from pwn import xor

HEX = "0e0b213f26041e480b26217f27342e175d0e070a3c5b103e2526217f27342e175d0e077e263451150104"

byteString = bytes.fromhex(HEX)
flagFragment = b"crypto{"

# Try XORing the flag fragment with the string to get a key fragment
print(xor(byteString, flagFragment))

We get an interesting byte string output:

b'myXORke+y_Q\x0bHOMe$~seG8bGURN\x04DFWg)a|\x1dTM!an\x7f'

We can assume the key starts with myXORkey so let's try XORing our guess with the byte string

# Test out the key
keyBit = b"myXORkey"
print(xor(keyBit, byteString))

Lo and behold, this yields the flag

Flag

crypto{1f_y0u_Kn0w_En0uGH_y0u_Kn0w_1t_4ll}

PreviousFavourite byteNextGreatest Common Divisor

Last updated 2 years ago

🧠