Open covert-encryption opened 2 years ago
Yes, this library predates from_buffer
in cffi
, but it should use it. pyca/cryptography
switched long ago but no one has done the work on pynacl
yet.
I couldn't find any way to use pynacl to encrypt large files as all the public API takes is bytes
. It's a pretty big limitation.
Use
ffi.from_buffer(...)
for conversions, so thatbytearray
,memoryview
and other things work too, instead of checking that the arguments arebytes
instances.I would also prefer being able to give output buffers to low level functions, for instance I had to do this hack to enable encryption without creating a new buffer. It works even in place, if
ciphertext
andmessage
are the same buffer:While for most things it does not matter if copies are made and new buffers are being allocated, stream ciphers can be much faster with proper buffer management.