A `TextEncryptor` uses a standard `BytesEncryptor` to encrypt text data.
Encrypted results are returned as hex-encoded strings for easy storage on the filesystem or in a database.
You can use the `Encryptors.queryableText` factory method to construct a "`queryable`" `TextEncryptor`:
.Queryable TextEncryptor
====
.Java
[source,java,role="primary"]
----
Encryptors.queryableText("password", "salt");
----
.Kotlin
[source,kotlin,role="secondary"]
----
Encryptors.queryableText("password", "salt")
----
====
The difference between a queryable `TextEncryptor` and a standard `TextEncryptor` has to do with initialization vector (IV) handling.
The IV used in a queryable `TextEncryptor.encrypt` operation is shared, or constant, and is not randomly generated.
This means the same text encrypted multiple times always produces the same encryption result.
This is less secure but necessary for encrypted data that needs to be queried against.
An example of queryable encrypted text would be an OAuth `apiKey`.
[[spring-security-crypto-keygenerators]]
== Key Generators
The {security-api-url}org/springframework/security/crypto/keygen/KeyGenerators.html[`KeyGenerators`] class provides a number of convenience factory methods for constructing different types of key generators.