-
Notifications
You must be signed in to change notification settings - Fork 0
crypto_onetimeauth
Wrapper for the crypto_onetimeauth
functions.
local luasodium = require'luasodium'
local key = luasodium.crypto_onetimeauth_keygen()
local auth = luasodium.crypto_onetimeauth('a message',key)
assert(luasodium.crypto_onetimeauth_verify(auth,'a message',key) == true)
luasodium.crypto_onetimeauth_BYTES
luasodium.crypto_onetimeauth_KEYBYTES
- crypto_onetimeauth
- crypto_onetimeauth_verify
- crypto_onetimeauth_keygen
- crypto_onetimeauth_init
- crypto_onetimeauth_update
- crypto_onetimeauth_final
syntax: string auth = luasodium.crypto_onetimeauth(string message, string key)
Generates a new authenticator for a given message
and key
.
syntax: boolean success = luasodium.crypto_onetimeauth_verify(string auth, string message, string key)
Verifies that a given auth
is valid for a given message
and key
.
Returns true
on success.
syntax: string key = luasodium.crypto_onetimeauth_keygen()
Generates a new, random key.
syntax: userdata state = luasodium.crypto_onetimeauth_init(string key)
Creates a new state
userdata for computing a onetimeauth in chunks, with key
.
Returned userdata has a metatable allowing object-oriented usage - methods are available for:
-
crypto_onetimeauth_update(state,message)
asstate:update(message)
-
crypto_onetimeauth_final(state)
asstate:final()
syntax: boolean success = crypto_onetimeauth_update(userdata state, string message)
Updates state
with the contents of message
.
syntax: string auth = crypto_onetimeauth_final(userdata state)
Returns the final authenticator for a given state
.