Is it safe to re-use RingCryptor?
Closed this issue · 2 comments
thedodd commented
Just wondering if it is safe to re-use a RingCryptor
instance? Or is it expected that a new instance be created before every encryption/decryption routine?
thedodd commented
Eh, looking at the code. The cryptor is dead simple, so there shouldn't be any overhead in creating a new one.
apyrgio commented
Just confirming that, yes, in the common case it's safe to reuse, since it doesn't have any state. Note however that if you specify any additional data (see .with_aad()
), then you should overwrite them or create a new RingCryptor
instance.