DuckDB Extension
Crypto
Compute cryptographic hashes, HMACs, password hashes, derived keys, and secure random bytes in DuckDB SQL. Hash individual values or build a checksum over ordered rows.
On this page
In the DuckDB 2.0 build, keccak224βkeccak512 compute real Keccak (Ethereum's variant) instead of SHA-3, and UUID, DECIMAL and ENUM values hash with a new canonical encoding. Digests stored by earlier builds for these inputs will differ. See Changes in the DuckDB 2.0 release.
Compute cryptographic digests and message authentication codes
A cryptographic digest gives a piece of data a fingerprint. An HMAC combines a digest algorithm with a secret key so a recipient can check that a message came from someone holding that key and has not changed.
Crypto makes these operations available as SQL functions over your columns. Use it to compare file or record contents, create checksums, or generate the authentication value required by an integration. When reproducing a digest from another system, match its input bytes, encoding, and algorithm.
Example
Hash a string with SHA-256
The hash function returns a BLOB. Convert it to hexadecimal to display or compare the digest.
Tested with DuckDB 1.5.6. Run this example in the DuckDB CLI or a native client.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL crypto FROM query_farm;
LOAD crypto FROM query_farm;
SELECT lower(to_hex(crypto_hash('sha2-256', 'hello world'))) AS sha256;
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://haybarn-extensions.query.farm';
INSTALL crypto FROM query_farm;
LOAD crypto FROM query_farm;
SELECT lower(to_hex(crypto_hash('sha2-256', 'hello world'))) AS sha256;
INSTALL crypto FROM community;
LOAD crypto;
SELECT lower(to_hex(crypto_hash('sha2-256', 'hello world'))) AS sha256;
Expected result
| sha256 |
|---|
| b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 |
A plain hash does not authenticate a message. Use HMAC when verification depends on a shared secret; use a password-hashing library for passwords.
Common tasks
Deep Dive
Technical Details
What this extension adds
DuckDB ships with hash() (non-cryptographic), md5(), and sha256(). The Crypto extension adds the rest of what production cryptographic workloads need:
- More algorithms β BLAKE3, BLAKE2b, BLAKE2s, the full SHA-2 family (including SHA-512/224 and SHA-512/256), the SHA-3 family, SHAKE128 / SHAKE256, Keccak (the Ethereum variant), RIPEMD-160, and SM3.
crypto_algorithms()lists them all, with their digest lengths and whether your OpenSSL build provides them. - More input types β every numeric type,
DECIMAL, VARCHAR, BLOB, BOOLEAN, DATE, TIME, TIME_TZ, every TIMESTAMP variant, INTERVAL, UUID, ENUM, string-backed types such as JSON and BIT, and lists or fixed-size arrays of those β not just strings. Different DuckDB types hash to different digests by design. - Extendable output β
crypto_hash_xofproduces as many bytes as you ask for from BLAKE3, SHAKE128, or SHAKE256. - HMAC with the same algorithm vocabulary β for keyed message authentication β and
crypto_equalsfor comparing MACs in constant time. - Key derivation β PBKDF2, HKDF, scrypt, and Argon2 for password hashing and for deriving keys from a secret.
crypto_hash_aggβ an order-deterministic aggregate hash for dataset checksums and change detection, usable as a window function.crypto_random_bytesβ cryptographically secure random bytes from OpenSSLβs CSPRNG.
Cryptographic vs non-cryptographic hashing
Use Crypto when you need:
- Tamper resistance β adversaries canβt construct collisions cheaply (BLAKE3, SHA-2, SHA-3).
- Authentication β HMAC for verifying message integrity with a shared secret.
- Stable cross-system fingerprints β agreed-upon algorithm output that other systems can compute identically (e.g. ETags, content-addressed storage).
- Secure random β keys, salts, nonces.
- Password hashing and key derivation β Argon2, scrypt, PBKDF2, HKDF.
Use Hashfuncs instead when you need:
- Speed β xxHash and RapidHash run at near-RAM bandwidth with no cryptographic guarantees.
- Hash partitioning, sharding, cache keys β collision risk on adversarial inputs is acceptable.
- Bloom-filter / cuckoo-filter inputs β paired with
bitfilters.
Both extensions can coexist; pick per use case.
Determinism and types
crypto_hash is deterministic for a given (algorithm, value, type) triple but is type-sensitive β 42::INTEGER and 42::BIGINT produce different hashes. This is the right behaviour for cryptographic use: it keeps the hash from collapsing across logically distinct domains.
Every value is turned into bytes by one canonical, platform-independent encoding, shared by crypto_hash, list hashing, and crypto_hash_agg:
| Type | Bytes that are hashed |
|---|---|
| VARCHAR, BLOB, JSON, BIT, VARCHAR aliases and collations | The stored bytes, as-is |
| Integers, FLOAT, DOUBLE, BOOLEAN, DATE, TIME, TIME_TZ, TIMESTAMP variants, INTERVAL | The fixed-width value, little-endian |
| UUID | The 16 bytes in RFC 9562 order β the same as hashing unhex() of the UUIDβs hex digits |
| DECIMAL | The unscaled value as a 16-byte integer, so the declared width doesnβt matter: 1.00::DECIMAL(4,2) and 1.00::DECIMAL(38,2) hash the same (and the same as 100::HUGEINT) |
| ENUM | The label, not its index β redefining or reordering the enum doesnβt change the hash |
| LIST, fixed-size ARRAY | Each element in order; an ARRAY hashes the same as the equivalent LIST |
SELECT crypto_hash('sha2-256', UUID '550e8400-e29b-41d4-a716-446655440000') = crypto_hash('sha2-256', unhex('550e8400e29b41d4a716446655440000')) AS same;-- trueLists of VARCHAR or BLOB values (and ENUM labels) include each elementβs length (as a 64-bit integer) before its content, defending against length-extension-style ambiguity attacks. Lists canβt contain NULL elements or nested types (lists of lists, structs); UNION and VARIANT values are rejected.
NULLs hash to NULL β crypto_hash('sha2-256', NULL::VARCHAR) IS NULL returns true.
Choosing an algorithm
Algorithm names are case-insensitive. crypto_algorithms() reports each oneβs family, implementation, digest length, and whether it is an extendable-output function (XOF) or can be used with HMAC:
SELECT name, family, digest_length, is_xof, supports_hmacFROM crypto_algorithms()WHERE availableORDER BY name;| Algorithm | Output | Notes |
|---|---|---|
blake3 |
32 B | Modern, fast β recommended default. XOF; keyed HMAC mode needs a 32-byte key |
blake2b-512 / blake2s-256 |
64 B / 32 B | BLAKE2 (RFC 7693) |
sha2-224, sha2-256, sha2-384, sha2-512 |
28β64 B | Industry-standard SHA-2 |
sha2-512/224, sha2-512/256 |
28 B / 32 B | SHA-512 truncated variants β faster than SHA-256 on 64-bit CPUs |
sha3-224 β¦ sha3-512 |
28β64 B | FIPS 202 SHA-3 |
shake128, shake256 |
32 B / 64 B by default | FIPS 202 XOFs; any length through crypto_hash_xof. Not usable with HMAC |
keccak224 β¦ keccak512 |
28β64 B | Original Keccak padding, as used by Ethereum β not SHA-3 |
sm3 |
32 B | Chinese national standard GB/T 32905 |
ripemd160 |
20 B | Used in Bitcoin addresses |
md5, sha1 |
16 B / 20 B | Legacy β not cryptographically secure |
md4 |
β | Only in OpenSSLβs legacy provider; reported as unavailable |
An unknown or unavailable algorithm name raises an error that lists the algorithms you can use.
Extendable output (XOF)
crypto_hash_xof(algorithm, value, length) produces length bytes (1 to 4,294,967,295) from blake3, shake128, or shake256. A shorter output is a prefix of a longer one, and the default length matches crypto_hash:
SELECT crypto_hash_xof('blake3', 'abc', 32) = crypto_hash('blake3', 'abc') AS blake3_prefix, crypto_hash_xof('shake128', 'abc', 32) = crypto_hash('shake128', 'abc') AS shake_prefix;-- true, trueAny other algorithm is an error: crypto_hash_xof requires an extendable-output algorithm (blake3, shake128, shake256).
HMAC and constant-time comparison
crypto_hmac(algorithm, key, message) accepts VARCHAR or BLOB for both the key and the message, so a key from crypto_random_bytes or unhex() works directly. A VARCHAR key is used verbatim β '\x41' is four characters, not the byte 0x41. blake3 uses its keyed mode, which requires a 32-byte key; shake128 and shake256 canβt be used with HMAC.
When verifying a MAC, compare with crypto_equals(a, b) rather than =. It compares VARCHAR/BLOB values with OpenSSLβs CRYPTO_memcmp, so the time taken doesnβt reveal how many leading bytes matched.
Key derivation
| Function | Standard | Use it for |
|---|---|---|
crypto_argon2(variant, password, salt, iterations, memory_kib, parallelism, length) |
RFC 9106 | Password hashing β argon2id is the OWASP first choice. Variants: argon2id, argon2i, argon2d. Salt must be at least 8 bytes; memory_kib at least 32 |
crypto_scrypt(password, salt, n, r, p, length) |
RFC 7914 | Password hashing; n must be a power of 2 |
crypto_pbkdf2(algorithm, password, salt, iterations, length) |
RFC 8018 | Password hashing where FIPS compliance or interoperability requires PBKDF2-HMAC. Not available with blake3 |
crypto_hkdf(algorithm, key, salt, info, length) |
RFC 5869 | Deriving several keys from one high-entropy secret β not for passwords. length is at most 255 Γ the digest length (8,160 bytes for sha2-256) |
Password, salt, key and info arguments accept VARCHAR or BLOB and give the same result for the same bytes. Output length is capped at 1 MiB. NULL in any argument returns NULL, and every argument may vary per row.
SELECT lower(to_hex(crypto_argon2('argon2id', 'password', 'somesalt', 2, 65536, 4, 32))) AS hash;-- 1a9677b0afe81fda7b548895e7a1bfeb8668ffc19a530e37e088a668fab1c02aAggregate hash semantics
crypto_hash_agg('algo', col ORDER BY ord) produces the same digest as crypto_hash('algo', LIST(col ORDER BY ord)). It accepts the same scalar types as crypto_hash (UUID, DECIMAL, ENUM, BOOLEAN, DATE, TIME, TIMESTAMP, INTERVAL, β¦) with the same encoding, but not lists or structs.
ORDER BYis required β DuckDBβs query planner doesnβt guarantee row order, so an unordered aggregate would be non-deterministic. A query without it is rejected when it is planned, withHash aggregation requires a distinct total ordering. Ordering only by theGROUP BYkey is not a total ordering of the rows in a group and is rejected too.- NULL values are an error (
crypto_hash_agg does not support NULL values). Skip them explicitly withFILTER (WHERE col IS NOT NULL). - It works as a window function.
crypto_hash_agg('sha2-256', v ORDER BY v) OVER (ORDER BY v)gives a running digest, equal tocrypto_hashof the matchinglist(v) OVER (...). In a window with noORDER BYat all β neither in the aggregate nor in theOVERclause β the missing ordering is not detected, so always order the frame. - An empty group returns NULL.
This equivalence is useful when comparing datasets across systems: anything that can produce the equivalent ordered list (Python, Go, Rust) can compute the same digest and verify a DuckDB result.
Random byte generation
crypto_random_bytes(n) returns n bytes from OpenSSLβs RAND_bytes(). Thatβs the same CSPRNG used by TLS implementations, key generation libraries, and openssl rand.
- Minimum length: 1 byte
- Maximum length: 4,294,967,295 bytes (4 GB β 1, DuckDBβs BLOB cap)
- Length 0 or negative raises
InvalidInputException
Memory limits
Large outputs β crypto_random_bytes, crypto_hash_xof, and the KDFs β are allocated through DuckDBβs buffer manager, and the working memory of scrypt (128 Γ n Γ r bytes) and Argon2 (memory_kib) is reserved before OpenSSL allocates it. All of it counts against memory_limit, so an oversized request fails with Out of Memory Error instead of exhausting the machine, and the memory is released when the query finishes.
Changes in the DuckDB 2.0 release
Digests of the following inputs differ from earlier builds. Recompute stored hashes, or keep them on the earlier build until you migrate.
keccak224/keccak256/keccak384/keccak512now compute real Keccak (the Ethereum variant). Earlier builds silently returned SHA-3 for these names.keccak256('abc')is now4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45. If you relied on the old behaviour, usesha3-256and friends.- UUID values hash as their 16 bytes in RFC 9562 order β the same as
crypto_hash(alg, unhex(...)). - DECIMAL hashes its unscaled value as a 16-byte integer, so the declared width no longer matters.
- ENUM hashes its label rather than its index.
crypto_hash_aggno longer casts DECIMAL input to DOUBLE; it uses the DECIMAL encoding above.md4is reported as unavailable (itβs only in OpenSSLβs legacy provider) instead of failing with an internal error.
Also new in the DuckDB 2.0 build:
- New functions:
crypto_hash_xof,crypto_equals,crypto_pbkdf2,crypto_hkdf,crypto_scrypt,crypto_argon2, and thecrypto_algorithms()table function. - New algorithms:
blake2s-256,ripemd160,sha2-512/224,sha2-512/256,shake128(32 bytes by default),shake256(64 bytes by default), andsm3. crypto_hmactakesVARCHARorBLOBfor the key and the message.- More
crypto_hashtypes: DECIMAL, ENUM, INTERVAL, TIME_TZ, the TIMESTAMP variants, fixed-size ARRAY (hashed like the equivalent LIST), and JSON, BIT and other string-backed types. crypto_hash_aggaccepts all the same scalar types, works as a window function, raises an error on NULL values, and enforcesORDER BYwhen the query is planned.- Memory: large outputs and KDF working memory respect
memory_limit(see Memory limits). - Performance: scalar hashing and HMAC are roughly 5β16Γ faster. SHA-256 over 10 million VARCHAR values went from 1.81 s to 0.21 s; HMAC with a constant key from 6.71 s to 0.42 s, because consecutive rows with the same key reuse the expanded key.
Reference
Extension Contents
Quick reference to all available functions and settings organized by category.
| Name | Type | Description |
|---|---|---|
|
HMAC
Keyed message authentication codes and constant-time comparison. Use for signing API requests, verifying message integrity, or building tamper-evident audit trails β anywhere a hash needs a shared secret. |
||
| crypto_equals() | Object type: Scalar function |
Constant-time comparison of two VARCHAR or BLOB values, using OpenSSL's CRYPTO_memcmp.
|
| crypto_hmac() | Object type: Scalar function | Hash-based Message Authentication Code (HMAC). |
|
Hashing
Compute cryptographic digests of values, lists, and entire datasets. Supports BLAKE3, BLAKE2b / BLAKE2s, the SHA-2 / SHA-3 families, SHAKE128 / SHAKE256 with any output length, Ethereum's Keccak, RIPEMD-160 and SM3, plus legacy MD5 / SHA-1 for compatibility. The aggregate variant produces an order-deterministic dataset checksum. |
||
| crypto_algorithms() | Object type: Table function |
Lists every hash algorithm the extension knows, with its family, implementation (openssl or blake3), digest length in bytes, whether it is an extendable-output function, whether it can be used with crypto_hmac, and whether the linked OpenSSL library provides it.
|
| crypto_hash() | Object type: Scalar function | Compute a cryptographic hash of a value with the given algorithm (case-insensitive). |
| crypto_hash_agg() | Object type: Aggregate function | Order-deterministic aggregate hash. |
| crypto_hash_xof() | Object type: Scalar function |
Extendable-output hash: returns length bytes (1 to 4,294,967,295) of a blake3, shake128 or shake256 digest.
|
|
Key Derivation
Password hashing and key derivation with Argon2, scrypt, PBKDF2 and HKDF. Use Argon2 or scrypt to store passwords, and HKDF to derive several keys from one high-entropy secret. |
||
| crypto_argon2() | Object type: Scalar function | Argon2 password hashing (RFC 9106). |
| crypto_hkdf() | Object type: Scalar function | HKDF extract-and-expand (RFC 5869). |
| crypto_pbkdf2() | Object type: Scalar function | PBKDF2-HMAC key derivation (RFC 8018). |
| crypto_scrypt() | Object type: Scalar function | scrypt password-based key derivation (RFC 7914). |
|
Random
Cryptographically secure random bytes from OpenSSL's CSPRNG. Use for encryption keys, salts, nonces, and any other cryptographic material that must be unpredictable. |
||
| crypto_random_bytes() | Object type: Scalar function | Cryptographically secure random bytes from OpenSSL's RAND_bytes. |
No extension contents match that search.
API Reference
Function Reference
Practical Examples
Cookbook
Real-world recipes and patterns for common use cases.
Hash a Column
crypto_hash returns a BLOB. For human-readable output, hex-encode it:
SELECT id, lower(to_hex(crypto_hash('sha2-256', email))) AS email_hashFROM users;Different DuckDB types of the same numeric value hash differently β 42::INTEGER, 42::BIGINT, and '42'::VARCHAR all produce distinct digests. Thatβs intentional; it keeps the hash from collapsing across logically distinct values.
Sign a Message
HMAC combines a secret key with a message under a hash algorithm:
SELECT lower(to_hex(crypto_hmac('sha2-256', :secret, request_body))) AS signatureFROM api_requests;The key and message may be VARCHAR or BLOB, so a key from crypto_random_bytes or unhex() works directly:
-- RFC 4231 test case 1SELECT lower(to_hex(crypto_hmac('sha2-256', unhex('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'), 'Hi There'))) AS mac;-- b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7To verify, the receiving side computes the same HMAC and compares it with the one it was sent. Use crypto_equals for that comparison β it runs in constant time, so response timing doesnβt leak how many leading bytes matched:
SELECT crypto_equals(crypto_hmac('sha2-256', 'k', 'm'), crypto_hmac('sha2-256', 'k', 'm')) AS valid, crypto_equals(crypto_hmac('sha2-256', 'k', 'm'), crypto_hmac('sha2-256', 'k', 'n')) AS tampered;-- true, falseGenerate a Salt
-- 16-byte random salt for password hashingSELECT crypto_random_bytes(16) AS salt;The bytes come from OpenSSLβs CSPRNG β suitable for cryptographic use. Length can be anything from 1 byte to 4 GB β 1, and large requests count against DuckDBβs memory_limit.
Hash a Password
A fast hash such as SHA-256 is not a password hash. Use a deliberately slow, memory-hard KDF β Argon2id is the usual first choice β with a random salt per user, and store the salt and parameters next to the hash:
SELECT lower(to_hex(crypto_argon2('argon2id', 'password', 'somesalt', 2, 65536, 4, 32))) AS hash;-- 1a9677b0afe81fda7b548895e7a1bfeb8668ffc19a530e37e088a668fab1c02aThe arguments are the variant, password, salt (at least 8 bytes), iterations, memory in KiB (64 MiB here), parallelism, and output length. crypto_scrypt and crypto_pbkdf2 are there when a system you interoperate with requires them:
-- RFC 7914 scrypt test vector: n = 1024, r = 8, p = 16SELECT lower(to_hex(crypto_scrypt('password', 'NaCl', 1024, 8, 16, 64))) AS scrypt;-- fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640
-- RFC 6070 PBKDF2-HMAC-SHA1 test vectorSELECT lower(to_hex(crypto_pbkdf2('sha1', 'password', 'salt', 4096, 20))) AS pbkdf2;-- 4b007901b765489abead49d926f721d065a429c1To check a login, recompute the hash from the stored salt and parameters and compare with crypto_equals. scrypt and Argon2 working memory counts against memory_limit, so a cost that is too high for the session fails with Out of Memory Error.
Derive Keys from a Secret
HKDF turns one high-entropy secret (a random master key, a key-exchange result) into as many independent keys as you need, separated by the info string. It is fast, so donβt use it on passwords:
-- RFC 5869 test case 1SELECT lower(to_hex(crypto_hkdf('sha2-256', unhex('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'), unhex('000102030405060708090a0b0c'), unhex('f0f1f2f3f4f5f6f7f8f9'), 42))) AS okm;-- 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865The output can be up to 255 Γ the digest length β 8,160 bytes for sha2-256.
Variable-Length Digests
crypto_hash_xof asks BLAKE3, SHAKE128, or SHAKE256 for exactly as many bytes as you need β a 100-byte fingerprint, a long keystream for a test fixture. Longer outputs extend shorter ones:
SELECT lower(to_hex(crypto_hash_xof('blake3', 'abc', 64))) AS digest;-- 6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d851fb250ae7393f5d02813b65d521a0d492d9ba09cf7ce7f4cffd900f23374bf0bEthereum Keccak-256
Ethereum uses the original Keccak padding, not the standardized SHA-3. keccak256 computes the Ethereum variant:
SELECT lower(to_hex(crypto_hash('keccak256', ''))) AS empty_keccak;-- c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470Builds before the DuckDB 2.0 release returned SHA-3 for the keccak* names; see Changes in the DuckDB 2.0 release.
Dataset Checksum
crypto_hash_agg is the aggregate counterpart of crypto_hash. Hashing all values in a column in a specified order produces a single deterministic digest you can use for change detection or to verify a partition matches a known-good baseline:
-- Whole-table checksumSELECT lower(to_hex(crypto_hash_agg('sha2-256', email ORDER BY email)))FROM users;-- Per-partition checksum β matches across systems if rows are identicalSELECT day, lower(to_hex(crypto_hash_agg('sha2-256', payload ORDER BY id))) AS day_hashFROM eventsGROUP BY dayORDER BY day;The ORDER BY is required β without it, hashes would be non-deterministic across query plans, so the query is rejected with Hash aggregation requires a distinct total ordering. Ordering by the group key alone isnβt enough; order by something that is unique within each group.
NULL values raise an error rather than being skipped silently. Leave them out explicitly:
SELECT crypto_hash_agg('sha2-256', x ORDER BY x) FILTER (WHERE x IS NOT NULL) = crypto_hash('sha2-256', [1, 3]) AS matchesFROM (VALUES (1), (NULL), (3)) t(x);-- truecrypto_hash_agg also works as a window function β a running checksum, or one per sliding frame. Give the window (or the aggregate) an ORDER BY; with neither, the missing ordering isnβt detected:
SELECT day, id, lower(to_hex(crypto_hash_agg('sha2-256', payload ORDER BY id) OVER (PARTITION BY day ORDER BY id))) AS running_hashFROM eventsORDER BY day, id;Tamper-Evident Audit Log
Build a hash chain by hashing each rowβs content together with the previous rowβs hash:
WITH chained AS ( SELECT id, action, user_id, created_at, LAG(hash) OVER (ORDER BY created_at) AS prev_hash, crypto_hash('sha2-256', [CAST(id AS VARCHAR), action, CAST(user_id AS VARCHAR), CAST(created_at AS VARCHAR), COALESCE(LAG(hash) OVER (ORDER BY created_at)::VARCHAR, '')] ) AS hash FROM audit_log)SELECT * FROM chained ORDER BY created_at;Verify the chain later by recomputing each hash and comparing β any tampering breaks the chain at the first altered row.
Stable IDs from Multiple Columns
Generate a deterministic ID from any combination of columns:
SELECT customer_email, product_sku, purchase_date, -- stable surrogate key, idempotent across re-runs lower(to_hex(crypto_hash('sha2-256', [customer_email, product_sku, CAST(purchase_date AS VARCHAR)] ))) AS purchase_idFROM raw_purchases;Pair with hashfuncs when you want the same property but cheaper (non-cryptographic) for partitioning, sharding, or cache keys.
Algorithm Reference
| Algorithm | Output | Notes |
|---|---|---|
blake3 |
32 B | Modern, fast β recommended default; any length via crypto_hash_xof |
blake2b-512 |
64 B | Strong all-rounder, no BLAKE3 hardware needed |
blake2s-256 |
32 B | BLAKE2 tuned for 32-bit and small platforms |
sha2-256 |
32 B | Industry standard SHA-2 |
sha2-512 |
64 B | Larger SHA-2 output |
sha2-512/256 |
32 B | Truncated SHA-512 β 32 bytes, faster than SHA-256 on 64-bit CPUs |
sha3-256 |
32 B | Keccak-based, post-SHA-2 standard |
shake256 |
64 B | SHA-3 XOF; any length via crypto_hash_xof |
keccak256 |
32 B | Original Keccak, as used by Ethereum β differs from sha3-256 |
sm3 |
32 B | Chinese national standard |
ripemd160 |
20 B | Bitcoin addresses |
md5 |
16 B | Legacy β fast but not cryptographically secure |
sha1 |
20 B | Legacy β not cryptographically secure |
SELECT * FROM crypto_algorithms() lists every algorithm, including sha2-224, sha2-384, sha2-512/224, the remaining SHA-3, SHAKE and Keccak sizes, and whether each one is available in your OpenSSL build (md4 is not).
Platform Support
Compatibility
Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.
Quick Facts
Platforms
DuckDB 2.0.0
- Linux x86_64aarch64
- Linux (musl) Not available
- macOS Apple Silicon
- Windows x86_64x86_64 (MinGW)
- WASM Not available
Compiled binary sizes
| Platform | Architecture | Size |
|---|---|---|
| Linux | x86_64 | 6.21 MB |
| Linux | aarch64 | 5.87 MB |
| macOS | Apple Silicon | 4.64 MB |
| Windows | x86_64 | 11.76 MB |
| Windows | x86_64 (MinGW) | 19.95 MB |
Compressed download sizes for the release shown above.
DuckDB & Haybarn
Release calendar- DuckDB v2.0.0 Query.Farm repository Supported
- Haybarn v1.5.6 Built-in community repository Supported
Browser examples use Haybarn-Wasm 2.0.0-rc12.
Checked .