Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb70d52b

Browse files
solved 26
1 parent8bf54cf commitb70d52b

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

‎26.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,43 @@
33

44
defmain():
55
file_path="maze/maze/mybroken.zip"
6-
first_step(file_path)
6+
result_file_path="maze/maze/my.zip"
7+
email_md5="bbb8b499a0eef99b52c7f13f4e78c24b"
8+
# first_step(file_path)
9+
second_step(email_md5,file_path,result_file_path)
710

811

912
deffirst_step(file_path):
1013
file=open(file_path,"rb")
14+
get_bytes_md5(file.read())
15+
16+
17+
defsecond_step(target,file_path,result_file_path):
18+
file=open(file_path,"rb")
19+
bs=file.read()
20+
finished=False
21+
foriinrange(len(bs)):
22+
forjinrange(256):
23+
bs_head=bs[:i]
24+
bs_center=chr(j).encode("latin1")
25+
bs_tail=bs[i+1:]
26+
new_bs=bs_head+bs_center+bs_tail
27+
now=get_bytes_md5(new_bs)
28+
ifnow==target:
29+
result_file=open(result_file_path,"wb")
30+
result_file.write(bs)
31+
print("Done! result={}".format(result_file_path))
32+
finished=True
33+
break
34+
iffinished:
35+
break
36+
37+
38+
defget_bytes_md5(hex_string):
39+
mymd5=hashlib.md5()
40+
mymd5.update(hex_string)
41+
hexdigest=mymd5.hexdigest()
42+
returnhexdigest
1143

1244

1345
if__name__=="__main__":

‎README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#pythonchallenge
22
Solve Problems inhttp://www.pythonchallenge.com
33

4+
####26
5+
result:http://www.pythonchallenge.com/pc/hex/speedboat.html
6+
```python
7+
import hashlib
8+
```
9+
- we get mybroken.zip in level 24
10+
- the decent means leopold mozart
11+
- we have sent an email to leopold mozart in level 19
12+
- fix the broken zip file to match the md5
13+
414

515
####25
616
result:http://www.pythonchallenge.com/pc/hex/decent.html

‎maze/maze/my.zip

2.64 KB
Binary file not shown.

‎read-bin-file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ def read_bin_file(file_path):
1818
# read_bin_file("indian/indian.wav")
1919
# read_bin_file("indian/result.wav")
2020
# read_bin_file("maze/maze/mybroken.gif")
21-
read_bin_file("lake/lake1.jpg")
21+
# read_bin_file("lake/lake1.jpg")
22+
read_bin_file("maze/maze/mybroken.zip")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp