day 25 part 1, gotta get all 49 stars before part 2 unlocks :(

This commit is contained in:
a 2020-12-25 02:11:39 -06:00
parent 9ba38eac9e
commit dd11e64c7a
2 changed files with 24 additions and 0 deletions

22
2020/25/25.py Normal file
View File

@ -0,0 +1,22 @@
pubkey1 = 3418282
pubkey2 = 8719412
subject = 7
mod = 20201227
loop1 = 0
value1 = 1
while value1 != pubkey1:
value1 = (value1 * subject) % mod
loop1 += 1
loop2 = 0
value2 = 1
while value2 != pubkey2:
value2 = (value2 * subject) % mod
loop2 += 1
enckey1 = pow(pubkey2,loop1,mod)
enckey2 = pow(pubkey1,loop2,mod)
assert enckey1 == enckey2
print(enckey1)

2
2020/25/input.txt Normal file
View File

@ -0,0 +1,2 @@
3418282
8719412