Juan José Gutiérrez de Quevedo Pérez 4 months ago
parent
commit
0eb5656a9b
1 changed files with 25 additions and 0 deletions
  1. 25 0
      25/1.py

+ 25 - 0
25/1.py

@@ -0,0 +1,25 @@
+key1 = 12092626
+key2 = 4707356
+
+def get_loop_size(key):
+    result = 1
+    loop = 1
+    while True:
+        result *= 7
+        result = result % 20201227
+        if key == result:
+            return loop
+        loop += 1
+
+def get_key(subject, loop_size):
+    result = 1
+    for __ in range(loop_size):
+        result *= subject
+        result = result % 20201227
+    return result
+
+key1_loopsize = get_loop_size(key1)
+key2_loopsize = get_loop_size(key2)
+
+print(get_key(key2, key1_loopsize))
+print(get_key(key1, key2_loopsize))