INNER CODE UNIT · Python
positions
rishitsaiya/CTFlearn-Writeups · Cryptography/ALEXCTF CR2: Many time secrets/cribdrag.py:26
positions = len(ctext)-crib_len+1
for index in xrange(positions):
single_result = ''
for a,b in zip(ctext[index:index+crib_len],crib):
single_result += chr(ord(a) ^ ord(b))
results.append(single_result)
return results
def print_linewrapped(text):
line_width = 40
text_len = len(text)
for chunk in xrange(0,text_len,line_width):
if chunk > text_len-line_width:
print str(chunk) + chr(9) + text[chunk:]
else:
print str(chunk) + chr(9) + text[chunk:chunk+line_width]