-
Couldn't load subscription status.
- Fork 23
Description
Hi there,
while trying to use this project, I've stumbled on the issue that it is not possible to use RNCryptor to en-/decrypt bytes().
Specifically here the result is always cast to str().
My workaround was to define a custom subclass that patches out this to_str() call like this:
class BytesCrypter(rncryptor.RNCryptor):
def post_decrypt_data(self, data):
# super call normalizes return value to str() which breaks us
data = data[:-rncryptor.bord(data[-1])]
return dataSince encrypt() already supports byte data, it would be very helpful if decrypt() could support that too. I'd imagine that could be achieved ether with a keyword (only) argument like this:
def decrypt(self, data, password, post_process=to_str):
# ...I would like the encryption interface to work solely on bytes if possible, especially on python 3 as that would be much more uniiversal, but I'm not sure if that api breakage would be ok - hence the post_process argument idea.