Module: Crypto::ShortHash
- Extended by:
- FFI::Library, Sodium::Utils
- Defined in:
- lib/crypto/short_hash.rb
Constant Summary collapse
- PRIMITIVE =
primitive.freeze
- BYTES =
bytes.freeze
- KEYBYTES =
keybytes.freeze
Constants included from Sodium::Utils
Sodium::Utils::HEXY, Sodium::Utils::ZERO
Class Method Summary collapse
Methods included from Sodium::Utils
bin2hex, check_length, get_size, hex2bin, zeros
Class Method Details
.shorthash(short_data, key) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/crypto/short_hash.rb', line 24 def shorthash(short_data, key) check_length(key, KEYBYTES, :SecretKey) siphash = zeros(BYTES) key.readonly if key.is_a?(Sodium::SecretBuffer) crypto_shorthash(siphash, short_data, get_size(short_data), key) siphash ensure key.noaccess if key.is_a?(Sodium::SecretBuffer) end |