bytes
This commit is contained in:
parent
6c9a3cfea1
commit
c2c2eda52e
|
@ -17,8 +17,8 @@ def remove_prefix(s_bytes, prefix):
|
||||||
|
|
||||||
:returns: `s_bytes` with `prefix` removed from the front.
|
:returns: `s_bytes` with `prefix` removed from the front.
|
||||||
"""
|
"""
|
||||||
if not s_bytes.startswith(prefix):
|
if s_bytes.startswith(prefix):
|
||||||
raise BadPrefixError(
|
return s_bytes[len(prefix):]
|
||||||
"did not see expected '{}' prefix".format(prefix)
|
raise BadPrefixError(
|
||||||
)
|
"did not see expected '{}' prefix".format(prefix)
|
||||||
return s_bytes[len(prefix):]
|
)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class EncryptedTemporaryFile(object):
|
||||||
iv = binascii.unhexlify("%032x" % offset_big)
|
iv = binascii.unhexlify("%032x" % offset_big)
|
||||||
cipher = aes.create_encryptor(self.key, iv)
|
cipher = aes.create_encryptor(self.key, iv)
|
||||||
# this is just to advance the counter
|
# 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)
|
return aes.encrypt_data(cipher, data)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|
Loading…
Reference in New Issue