-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14-2.py
More file actions
33 lines (25 loc) · 701 Bytes
/
14-2.py
File metadata and controls
33 lines (25 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from hashlib import md5
from functools import lru_cache
import re
from progressbar import progressbar
salt = 'yjdafjpo'
@lru_cache(None)
def get_extended_hash(s: int) -> str:
h = salt + str(s)
for _ in range(2017):
h = md5(h.encode()).hexdigest()
return h
i = 0
for _ in progressbar(range(64)):
while True:
i += 1
if m := re.search(r'(.)\1{2}', get_extended_hash(i)):
c = m.group(1)[0]
found = False
for j in range(1, 1000):
if mm := re.search(rf'({c})\1{{4}}', get_extended_hash(i + j)):
found = True
break
if found:
break
print(i)