Upload files to 'tasks/cringe_random'

This commit is contained in:
dragonmuffin 2023-08-25 14:51:08 +00:00
parent 1561961242
commit a8959c6760
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import random
n = 10
flag_len = 20
state = [random.randint(0, (1 << n) - 1) for i in range(n)]
k = 0
def update_state():
for i in range(n):
state.append(state[0])
for j in range(1, n):
state[j] ^= ((state[0] >> j) & 1) << i
state.pop(0)
def get_random():
global k
if(k == n):
k = 0
update_state()
k += 1
return state[k - 1]
flag='ctf{' + (''.join([chr(get_random() % 26 + ord('a')) for i in range(flag_len)])) + '}'
print(flag)
update_state()
print(state)

View file

@ -0,0 +1,2 @@
ctf{********************}
[110, 557, 303, 18, 127, 615, 844, 924, 177, 541]