Back to Exposed

Hashed

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

1.5.02.4 KB
Original Source

Hashed

class Hashed(hasher: Hasher, val encodedValue: String)

A hashed column holds these rather than strings, which is what keeps a plaintext value from being stored in one by accident, or compared against one in SQL. Assigning a Hashed read from the database back to a column stores it unchanged, without hashing it a second time.

Constructing one directly wraps encodedValue as it is, without hashing it. Do that to adopt hashes produced elsewhere, such as when migrating existing values into a hashed column; to hash a plaintext value, use Hasher.hash.

Members

Constructors

Hashed

Link copied to clipboard

constructor(hasher: Hasher, encodedValue: String)

Properties

encodedValue

Link copied to clipboard

val encodedValue: String

The encoded hash, as stored in the database.

Functions

equals

Link copied to clipboard

open operator override fun equals(other: Any?): Boolean

hashCode

Link copied to clipboard

open override fun hashCode(): Int

matches

Link copied to clipboard

fun matches(plainText: String): Boolean

Returns whether plainText hashes to this value, as determined by the Hasher that produced it.

toString

Link copied to clipboard

open override fun toString(): String

Generated by Dokka © 2026 Copyright