Cookie Consent by PrivacyPolicies.com

Archives of tag crypto


Tag crypto

DarkCTF 2020: Cryptography/haxXor

Cryptography/haxXor

281 points

you either know it or not take this and get your flag

5552415c2b3525105a4657071b3e0b5f494b034515

Solution

I've wrote small python script to solve the challange (it was xor ;-)).

from pwnlib.util.fiddling import xor

flag = bytes.fromhex('5552415c2b3525105a4657071b3e0b5f494b034515')
flag_prefix = b'darkCTF{'
xorstr = xor(flag_prefix, flag[:len(flag_prefix)])
print(xor(flag, xorstr))



darkCTF{kud0s_h4xx0r}

DarkCTF 2020: Cryptography/WEIRD ENCRYPTION

Cryptography/WEIRD ENCRYPTION

377 points

I made this weird encryption I hope you can crack it.

File

enc.py

prefix="Hello. Your flag is DarkCTF{"
suffix="}."
main_string="c an u br ea k th is we ir d en cr yp ti on".split()

clear_text = prefix + flag + suffix
enc_text = ""
for letter in clear_text:
c1 = ord(letter) / 16
c2 = ord(letter) % 16
enc_text += main_string[c1]
enc_text += main_string[c2]

print enc_text

Encrypted

eawethkthcrthcrthonutiuckirthoniskisuucthththcrthanthisucthirisbruceaeathanisutheneabrkeaeathisenbrctheneacisirkonbristhwebranbrkkonbrisbranthypbrbrkonkirbrciskkoneatibrbrbrbrtheakonbrisbrckoneauisubrbreacthenkoneaypbrbrisyputi

Solution

main_string = "c an u br ea k th is we ir d en cr yp ti on".split()
flag = open('Encrypted', 'r').read()

def decrypt(letter):
return main_string.index(letter[0]) * 16 + main_string.index(letter[1])


part = ''
letter = []
decrypted = ''
for j, i in enumerate(flag):
part += i
if part in main_string and not (part == 'c' and flag[j+1] == 'r'):
letter.append(part)
part = ''
if len(letter) == 2:
decrypted += chr(decrypt(letter))
letter = []

print(decrypted)

DarkCTF{[email protected][email protected]_M3}

 

DownUnderCTF 2020: rot-i

rot-i

100 points

Author: joseph

ROT13 is boring!

Attached files:

  • challenge.txt (sha256: ab443133665f34333aa712ab881b6d99b4b01bdbc8bb77d06ba032f8b1b6d62d)

challenge.txt

Ypw'zj zwufpp hwu txadjkcq dtbtyu kqkwxrbvu! Mbz cjzg kv IAJBO{ndldie_al_aqk_jjrnsxee}. Xzi utj gnn olkd qgq ftk ykaqe uei mbz ocrt qi ynlu, etrm mff'n wij bf wlny mjcj :).

Solution

I wrote below python script to decode the message:

characters_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
characters_lower = "abcdefghijklmnopqrstuvwxyz"
flag = "Ypw'zj zwufpp hwu txadjkcq dtbtyu kqkwxrbvu! Mbz cjzg kv IAJBO{ndldie_al_aqk_jjrnsxee}. Xzi utj gnn olkd qgq ftk ykaqe uei mbz ocrt qi ynlu, etrm mff'n wij bf wlny mjcj :)."
counter1 = 1
counter2 = 27

for i, j in enumerate(flag):
counter1 -= 1
counter2 -= 1
if j.islower():
characters = characters_lower
elif j.isupper():
characters = characters_upper
else:
print(j, end='')
continue
if (i % 2) == 0:
encoded_index = characters.index(j) + counter1
else:
encoded_index = characters.index(j) + counter2
while encoded_index > len(characters) - 1:
encoded_index -= len(characters)
while encoded_index < 0:
encoded_index += len(characters)
print(characters[encoded_index], end='')

Output:
You've solved the beginner crypto challenge! The flag is DUCTF{crypto_is_fun_kjqlptzy}. Now get out some pen and paper for the rest of them, they won't all be this easy :).

DUCTF{crypto_is_fun_kjqlptzy}