Skip to content

Commit

Permalink
Quartz sync: Sep 20, 2024, 11:44 AM
Browse files Browse the repository at this point in the history
  • Loading branch information
Tan-JunWei committed Sep 20, 2024
1 parent 125cf49 commit 79a99f2
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 53 deletions.
50 changes: 0 additions & 50 deletions challenge.py
Original file line number Diff line number Diff line change
@@ -1,50 +0,0 @@
'''
p = 97
g = 31
a = 97 (random number from p-10 to p, both included)
b = 22 (random number from g-10 to g, both included)
u = g^a mod p
u = 31
v = g^b mod p
v = 54
key = v^a mod p
key = 54
b_key = u^b mod p
b_key = 54
So, shared_key = key = b_key = 54
semi_cipher = dynamic_xor_encrypt(flag, "trudeau")
cipher = encrypt(semi_cipher, shared_key)
'''
cipher = [151146, 1158786, 1276344, 1360314, 1427490, 1377108, 1074816, 1074816, 386262, 705348, 0,
1393902, 352674, 83970, 1141992, 0, 369468, 1444284, 16794, 1041228, 403056, 453438, 100764,
100764, 285498, 100764, 436644, 856494, 537408, 822906, 436644, 117558, 201528, 285498]

def decrypt_semi_flag(key):
semi_flag = ""
for chr_cipher in cipher:
x = chr(chr_cipher // (key*311))
semi_flag += x
return semi_flag

def dynamic_xor_decrypt(semi_flag, key):
flag = ""
key_length = len(key)
for i, char in enumerate(semi_flag):
key_char = key[i % key_length]
decrypted_char = chr(ord(char) ^ ord(key_char))
flag += decrypted_char
return flag

semi_flag = decrypt_semi_flag(54)
flag = dynamic_xor_decrypt(semi_flag, "trudeau")
print(flag[::-1]) # unreverse the flag



File renamed without changes.
4 changes: 2 additions & 2 deletions content/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: CTF Writeups
modified: 2024-09-11T22:15:40+08:00
modified: 2024-09-20T11:44:54+08:00
---

![[banner.jpg]]
Expand All @@ -13,7 +13,7 @@ modified: 2024-09-11T22:15:40+08:00
Welcome to my Capture The Flag (CTF) writeups page! Here you'll find detailed explanations and solutions to various CTF challenges I've tackled.
## The Ongoing Journey 💡

As of **11 September 2024**, this CTF-writeups page has a total of **98** writeups across different topics. As I continue to explore and glean deeper insights, this project will remain a living document, constantly evolving and improving. Regular updates will be made to refine the content, introduce fresh perspectives, and integrate the latest knowledge. Stay tuned for ongoing enhancements!
As of **20 September 2024**, this CTF-writeups page has a total of **102** writeups across different topics. As I continue to explore and glean deeper insights, this project will remain a living document, constantly evolving and improving. Regular updates will be made to refine the content, introduce fresh perspectives, and integrate the latest knowledge. Stay tuned for ongoing enhancements!
## Navigation 🗺️

### PicoCTF
Expand Down
1 change: 0 additions & 1 deletion man.py

This file was deleted.

0 comments on commit 79a99f2

Please sign in to comment.