libsodium_crypto_shorthash_siphashx24 (libsodium v3.0.1)
View SourceKeyed hashing of short inputs with SipHash-2-4 with 128-bit output, producing bytes/0
byte (128-bit) outputs under a keybytes/0 byte secret key.
It is designed for hash tables, Bloom filters, and similar structures
where an attacker must not be able to predict collisions. It is not a
general-purpose or collision-resistant cryptographic hash; use
libsodium_crypto_generichash for that. Keys can be generated with
libsodium_crypto_shorthash:keygen/0.
Key = libsodium_randombytes:buf(libsodium_crypto_shorthash_siphashx24:keybytes()),
Hash = libsodium_crypto_shorthash_siphashx24:crypto_shorthash_siphashx24(<<"short input">>, Key),
16 = byte_size(Hash),
Hash = libsodium_crypto_shorthash_siphashx24:crypto_shorthash_siphashx24(<<"short input">>, Key).
Summary
Types
A crypto_shorthash_siphashx24_KEYBYTES (16-byte) binary.
A crypto_shorthash_siphashx24_BYTES (16-byte) binary.
Functions
Return crypto_shorthash_siphashx24_bytes(), in bytes.
Hash In under the keybytes/0 byte key K, returning bytes/0 bytes.
Return crypto_shorthash_siphashx24_keybytes(), in bytes.
Types
Functions
-spec bytes() -> Result when Result :: 16.
Return crypto_shorthash_siphashx24_bytes(), in bytes.
-spec crypto_shorthash_siphashx24(In, K) -> Result when In :: binary(), K :: k(), Result :: out() | -1.
Hash In under the keybytes/0 byte key K, returning bytes/0 bytes.
-spec keybytes() -> Result when Result :: 16.
Return crypto_shorthash_siphashx24_keybytes(), in bytes.