This commit is contained in:
meejah 2019-07-08 14:16:28 -06:00
parent 6c9a3cfea1
commit c2c2eda52e
2 changed files with 6 additions and 6 deletions

View File

@ -17,8 +17,8 @@ def remove_prefix(s_bytes, prefix):
:returns: `s_bytes` with `prefix` removed from the front.
"""
if not s_bytes.startswith(prefix):
raise BadPrefixError(
"did not see expected '{}' prefix".format(prefix)
)
return s_bytes[len(prefix):]
if s_bytes.startswith(prefix):
return s_bytes[len(prefix):]
raise BadPrefixError(
"did not see expected '{}' prefix".format(prefix)
)

View File

@ -111,7 +111,7 @@ class EncryptedTemporaryFile(object):
iv = binascii.unhexlify("%032x" % offset_big)
cipher = aes.create_encryptor(self.key, iv)
# this is just to advance the counter
aes.encrypt_data(cipher, "\x00" * offset_small)
aes.encrypt_data(cipher, b"\x00" * offset_small)
return aes.encrypt_data(cipher, data)
def close(self):