module Crypto::ShortHash

Constants

BYTES
KEYBYTES
PRIMITIVE

Public Instance Methods

shorthash(short_data, key) click to toggle source
# 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