diff --git a/tasks/cringe_random/cringe_random.py b/tasks/cringe_random/cringe_random.py new file mode 100644 index 0000000..bfda23c --- /dev/null +++ b/tasks/cringe_random/cringe_random.py @@ -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) diff --git a/tasks/cringe_random/output.txt b/tasks/cringe_random/output.txt new file mode 100644 index 0000000..ab30750 --- /dev/null +++ b/tasks/cringe_random/output.txt @@ -0,0 +1,2 @@ +ctf{********************} +[110, 557, 303, 18, 127, 615, 844, 924, 177, 541]