Back to Exposed

BCryptHasher

docs/api/exposed-crypt/org.jetbrains.exposed.v1.crypt/-b-crypt-hasher/index.html

1.5.01.8 KB
Original Source

BCryptHasher

class BCryptHasher(strength: Int = DEFAULT_STRENGTH) : PasswordEncoderHasher

Hasher that uses the bcrypt algorithm, salting each value individually.

Encoded values are always 60 characters long.

Parameters

strength

Log rounds of hashing work to perform, between 4 and 31, where each increment doubles the time taken. Defaults to the same value as Spring Security's BCryptPasswordEncoder.

Members

Constructors

BCryptHasher

Link copied to clipboard

constructor(strength: Int = DEFAULT_STRENGTH)

Functions

hash

Link copied to clipboard

open override fun hash(plainText: String): Hashed

Hashes plainText into the value to be stored, salting it if the algorithm supports salting.

matches

Link copied to clipboard

open override 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