Cookie Consent by PrivacyPolicies.com

Archives of tag cryptography


Tag cryptography

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}