apyrgio/tindercrypt

Is it safe to re-use RingCryptor?

Closed this issue · 2 comments

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?

Eh, looking at the code. The cryptor is dead simple, so there shouldn't be any overhead in creating a new one.

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.