Skip to content

Commit 29d89f7

Browse files
authored
Merge pull request #2 from spaceone/master
fix selection of "unknown"-char
2 parents 3a5fefb + ec2990a commit 29d89f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/padding_oracle/solver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def remove_padding(data: Union[str, bytes]):
5252

5353

5454
def plaintext_list_to_bytes(plaintext_list, unknown=b' '):
55-
plaintext_bytes = bytes(unknown if b is None else b
55+
plaintext_bytes = bytes(ord(unknown) if b is None else b
5656
for b in plaintext_list)
5757
return plaintext_bytes
5858

@@ -61,7 +61,7 @@ def solve(**kwargs):
6161
cipher = kwargs.pop('cipher')
6262
unknown = kwargs.pop('unknown', b' ')
6363
solver = Solver(**kwargs)
64-
plaintext = plaintext_list_to_bytes(solver.solve(cipher))
64+
plaintext = plaintext_list_to_bytes(solver.solve(cipher), unknown)
6565
plaintext = remove_padding(plaintext)
6666
return plaintext
6767

0 commit comments

Comments
 (0)