module Crypto::Auth
Constants
- BYTES
- KEYBYTES
- PRIMITIVE
Public Instance Methods
auth(message, key)
click to toggle source
# File lib/crypto/auth.rb, line 25 def auth(message, key) check_length(key, KEYBYTES, :SecretKey) mac = zeros(BYTES) key.readonly if key.is_a?(Sodium::SecretBuffer) crypto_auth(mac, message, get_size(message), key) mac ensure key.noaccess if key.is_a?(Sodium::SecretBuffer) end
verify(mac, message, key)
click to toggle source
# File lib/crypto/auth.rb, line 37 def verify(mac, message, key) check_length(mac, BYTES, :Mac) check_length(key, KEYBYTES, :SecretKey) key.readonly if key.is_a?(Sodium::SecretBuffer) crypto_auth_verify(mac, message, get_size(message), key) == 0 ensure key.noaccess if key.is_a?(Sodium::SecretBuffer) end