docs/api/exposed-crypt/org.jetbrains.exposed.v1.crypt/-hasher/index.html
interface Hasher
Base class responsible for the one-way hashing of data.
Unlike Encryptor, a Hasher cannot recover the original value: the only operation available on a stored hash is checking whether some plaintext produces it. Use this for values that never need to be read back, such as passwords.
BCryptHasher, Argon2Hasher, Pbkdf2Hasher, and SCryptHasher cover the algorithms recommended by the OWASP password storage cheat sheet. To hash with something else, wrap any Spring Security PasswordEncoder in a PasswordEncoderHasher, or implement the two operations declared here:
class CustomHasher : Hasher { override fun hash(plainText: String): Hashed = Hashed(this, customLibrary.hash(plainText)) override fun matches(plainText: String, encodedValue: String): Boolean = customLibrary.verify(plainText, encodedValue)}
Content copied to clipboard
Members
Link copied to clipboard
abstract fun hash(plainText: String): Hashed
Hashes plainText into the value to be stored, salting it if the algorithm supports salting.
Link copied to clipboard
abstract fun matches(plainText: String, encodedValue: String): Boolean
Returns whether plainText hashes to encodedValue, which is expected to be an already hashed value.
Generated by Dokka © 2026 Copyright