Fast binary-encoded hashing with streaming digest. ~6-14x faster than hasch.core for most data types.
Key optimizations:
IMPORTANT: This produces different hashes than hasch.core/uuid due to binary encoding. Use hasch.core for legacy compatibility or when you need string-based number representation.
Fast binary-encoded hashing with streaming digest. ~6-14x faster than hasch.core for most data types. Key optimizations: 1. Binary encoding for numbers (2000x faster than string conversion) 2. Streaming digest - update MessageDigest directly, no intermediate byte arrays 3. Single MessageDigest instance per hash operation 4. Pre-allocated buffers for common sizes IMPORTANT: This produces different hashes than hasch.core/uuid due to binary encoding. Use hasch.core for legacy compatibility or when you need string-based number representation.
(b64-hash val)Base64 encoded hash string.
Base64 encoded hash string.
(edn-hash val)(edn-hash val md-create-fn)(edn-hash val md-create-fn write-handlers)Hash any EDN value using streaming binary encoding.
Options:
Returns byte array of hash.
Hash any EDN value using streaming binary encoding. Options: - md-create-fn: Function to create MessageDigest (default: SHA-512) - write-handlers: incognito write-handlers map for record serialization Returns byte array of hash.
(hash->str bytes)Convert hash bytes to hex string.
Convert hash bytes to hex string.
Protocol for streaming hash updates. Instead of creating intermediate byte arrays, implementations update the MessageDigest directly.
Protocol for streaming hash updates. Instead of creating intermediate byte arrays, implementations update the MessageDigest directly.
(-update-digest this md)(sha256-message-digest)Create a SHA-256 hasher.
Create a SHA-256 hasher.
(sha256-uuid val)SHA-256 based UUID (faster, still cryptographically secure).
SHA-256 based UUID (faster, still cryptographically secure).
(sha512-message-digest)Create a SHA-512 hasher.
Create a SHA-512 hasher.
(squuid)(squuid base-uuid)Sequential UUID with timestamp prefix. With no args, generates a random base UUID. With a UUID arg, uses that as base.
Sequential UUID with timestamp prefix. With no args, generates a random base UUID. With a UUID arg, uses that as base.
(uuid)(uuid val)(uuid val md-create-fn)Generate UUID-5 from hash of value, or random UUID-4 with no arguments.
Uses binary encoding for ~10-100x faster hashing than hasch.core/uuid for data with many numbers.
Optionally accepts write-handlers for record serialization via incognito.
Generate UUID-5 from hash of value, or random UUID-4 with no arguments. Uses binary encoding for ~10-100x faster hashing than hasch.core/uuid for data with many numbers. Optionally accepts write-handlers for record serialization via incognito.
(uuid4)Generates a UUID version 4 (random).
Generates a UUID version 4 (random).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |