Skip to content

Commit

Permalink
process xor recognizes 1-byte case
Browse files Browse the repository at this point in the history
  • Loading branch information
arekbulski committed Apr 1, 2018
1 parent 47faa45 commit a9d9d9a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kaitaistruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ def process_xor_one(data, key):
def process_xor_many(data, key):
if key == b'\x00' * len(key):
return data
if len(key) == 1:
return KaitaiStream.process_xor_one(data, ord(key))

if PY2:
return bytes(bytearray(a ^ b for a, b in zip(bytearray(data), itertools.cycle(bytearray(key)))))
Expand Down

0 comments on commit a9d9d9a

Please sign in to comment.