Hashing

object Hashing

Pure-Kotlin SHA-1 / SHA-256 (no java.*, wasmJs-safe). Content-fingerprint / cache-key hashing — not a security primitive: no HMAC, no constant-time comparison, no salting.

Functions

Link copied to clipboard
fun sha1(bytes: ByteArray): ByteArray

SHA-1 digest of bytes (20 bytes).

Link copied to clipboard
fun sha1Hex(text: String): String

Lowercase hex of the SHA-1 digest of text (UTF-8).

Link copied to clipboard

SHA-256 digest of bytes (32 bytes).

Link copied to clipboard
fun sha256Hex(text: String): String

Lowercase hex of the SHA-256 digest of text (UTF-8).