You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AES-SIV currently creates a new cipher object on each call to encryptDeterministically and decryptDeterministically. But creating these objects is expensive, and it requires locks, which make it even worse when done in multiple threads.
AES-SIV is often used to encrypt small values, for example EncryptedSharedPreferences uses it to encrypt keys in key-value pairs, which are typically small.
So we should add the same solution as proposed in tink-crypto/tink#208 and use ThreadLocal ciphers objects.
The text was updated successfully, but these errors were encountered:
We already do the same thing for other key type, such as AES-GCM.
See also: #36, and #24.
I run some benchmarks for this, where I encrypt some data using AES-SIV many times.
- For 1kb data, it get 2.5x faster for a single thread, and 5.6x faster for 10 threads in parallel.
- For 32 bytes data, it gets 15x faster for a single thread, and 41x faster for 10 threads in parallel.
PiperOrigin-RevId: 629075782
Change-Id: I6735eafe4670213af15084343a7f269885d1101b
This is the same issue as already discussed here for AES-GCM:
tink-crypto/tink#208
AES-SIV currently creates a new cipher object on each call to encryptDeterministically and decryptDeterministically. But creating these objects is expensive, and it requires locks, which make it even worse when done in multiple threads.
AES-SIV is often used to encrypt small values, for example EncryptedSharedPreferences uses it to encrypt keys in key-value pairs, which are typically small.
So we should add the same solution as proposed in tink-crypto/tink#208 and use ThreadLocal ciphers objects.
The text was updated successfully, but these errors were encountered: