-
Notifications
You must be signed in to change notification settings - Fork 0
crypto_stream
Wrappers for the crypto_stream
functions.
local luasodium = require'luasodium'
local message = 'a message to xor'
local key = luasodium.crypto_stream_keygen()
local nonce = string.rep('\0',luasodium.crypto_stream_NONCEBYTES)
local xord = luasodium.crypto_stream_xor(message,nonce,key)
assert(luasodium.crypto_stream_xor(xord,nonce,key) == message)
luasodium.crypto_stream_NONCEBYTES
luasodium.crypto_stream_KEYBYTES
luasodium.crypto_stream_xsalsa20_NONCEBYTES
luasodium.crypto_stream_xsalsa20_KEYBYTES
luasodium.crypto_stream_salsa20_NONCEBYTES
luasodium.crypto_stream_xsalsa20_KEYBYTES
luasodium.crypto_stream_salsa2012_NONCEBYTES
luasodium.crypto_stream_xsalsa2012_KEYBYTES
luasodium.crypto_stream_xchacha20_NONCEBYTES
luasodium.crypto_stream_xchacha20_KEYBYTES
luasodium.crypto_stream_chacha20_NONCEBYTES
luasodium.crypto_stream_chacha20_KEYBYTES
luasodium.crypto_stream_chacha20_ietf_NONCEBYTES
luasodium.crypto_stream_chacha20_ietf_KEYBYTES
- crypto_stream
- crypto_stream_xor
- crypto_stream_keygen
- crypto_stream_xsalsa20
- crypto_stream_xsalsa20_xor
- crypto_stream_xsalsa20_xor_ic
- crypto_stream_xsalsa20_keygen
- crypto_stream_salsa20
- crypto_stream_salsa20_xor
- crypto_stream_salsa20_xor_ic
- crypto_stream_salsa20_keygen
- crypto_stream_salsa2012
- crypto_stream_salsa2012_xor
- crypto_stream_salsa2012_keygen
- crypto_stream_salsa208
- crypto_stream_salsa208_xor
- crypto_stream_salsa208_keygen
- crypto_stream_xchacha20
- crypto_stream_xchacha20_xor
- crypto_stream_xchacha20_xor_ic
- crypto_stream_xchacha20_keygen
- crypto_stream_chacha20
- crypto_stream_chacha20_xor
- crypto_stream_chacha20_xor_ic
- crypto_stream_chacha20_keygen
- crypto_stream_chacha20_ietf
- crypto_stream_chacha20_ietf_xor
- crypto_stream_chacha20_ietf_xor_ic
- crypto_stream_chacha20_ietf_keygen
syntax: string pseudorandom = luasodium.crypto_stream(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
.
syntax: string result = luasodium.crypto_stream_xor(string message, string nonce, string key)
Applies the crypto_stream_xor
operation to a message
with nonce
and key
.
syntax string key = luasodium.crypto_stream_keygen()
Returns a new, random key (with length crypto_stream_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_xsalsa20(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the XSalsa20 stream cipher.
syntax: string result = luasodium.crypto_stream_xsalsa20_xor(string message, string nonce, string key)
Applies the crypto_stream_xsalsa20_xor
operation to a message
with nonce
and key
.
syntax: string result = luasodium.crypto_stream_xsalsa20_xor_ic(string message, string nonce, string key, number ic)
Applies the crypto_stream_xsalsa20_xor_ic
operation to a message
with nonce
and key
, with the initial value of the block counter set to ic
.
syntax string key = luasodium.crypto_stream_xsalsa20_keygen()
Returns a new, random key (with length crypto_stream_xsalsa20_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_salsa20(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the Salsa20 stream cipher.
syntax: string result = luasodium.crypto_stream_salsa20_xor(string message, string nonce, string key)
Applies the crypto_stream_salsa20_xor
operation to a message
with nonce
and key
.
syntax: string result = luasodium.crypto_stream_salsa20_xor_ic(string message, string nonce, string key, number ic)
Applies the crypto_stream_salsa20_xor_ic
operation to a message
with nonce
and key
, with the initial value of the block counter set to ic
.
syntax string key = luasodium.crypto_stream_salsa20_keygen()
Returns a new, random key (with length crypto_stream_salsa20_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_salsa2012(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the Salsa20 stream cipher.
syntax: string result = luasodium.crypto_stream_salsa2012_xor(string message, string nonce, string key)
Applies the crypto_stream_salsa2012_xor
operation to a message
with nonce
and key
.
syntax string key = luasodium.crypto_stream_salsa2012_keygen()
Returns a new, random key (with length crypto_stream_salsa2012_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_salsa208(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the Salsa20 stream cipher.
syntax: string result = luasodium.crypto_stream_salsa208_xor(string message, string nonce, string key)
Applies the crypto_stream_salsa208_xor
operation to a message
with nonce
and key
.
syntax string key = luasodium.crypto_stream_salsa208_keygen()
Returns a new, random key (with length crypto_stream_salsa208_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_xchacha20(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the XChaCha20 stream cipher.
syntax: string result = luasodium.crypto_stream_xchacha20_xor(string message, string nonce, string key)
Applies the crypto_stream_xchacha20_xor
operation to a message
with nonce
and key
.
syntax: string result = luasodium.crypto_stream_xchacha20_xor_ic(string message, string nonce, string key, number ic)
Applies the crypto_stream_salsa20_xor_ic
operation to a message
with nonce
and key
, with the initial value of the block counter set to ic
.
syntax string key = luasodium.crypto_stream_xchacha20_keygen()
Returns a new, random key (with length crypto_stream_xchacha20_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_chacha20(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the ChaCha20 stream cipher.
syntax: string result = luasodium.crypto_stream_chacha20_xor(string message, string nonce, string key)
Applies the crypto_stream_chacha20_xor
operation to a message
with nonce
and key
.
syntax: string result = luasodium.crypto_stream_chacha20_xor_ic(string message, string nonce, string key, number ic)
Applies the crypto_stream_salsa20_xor_ic
operation to a message
with nonce
and key
, with the initial value of the block counter set to ic
.
syntax string key = luasodium.crypto_stream_chacha20_keygen()
Returns a new, random key (with length crypto_stream_chacha20_KEYBYTES
).
syntax: string pseudorandom = luasodium.crypto_stream_chacha20_ietf(number length, string nonce, string key)
Return a string of pseudo random bytes using the given nonce
and key
, using the ChaCha20 stream cipher (IETF variant).
syntax: string result = luasodium.crypto_stream_chacha20_ietf_xor(string message, string nonce, string key)
Applies the crypto_stream_chacha20_ietf_xor
operation to a message
with nonce
and key
.
syntax: string result = luasodium.crypto_stream_chacha20_ietf_xor_ic(string message, string nonce, string key, number ic)
Applies the crypto_stream_salsa20_ietf_xor_ic
operation to a message
with nonce
and key
, with the initial value of the block counter set to ic
.
syntax string key = luasodium.crypto_stream_chacha20_ietf_keygen()
Returns a new, random key (with length crypto_stream_chacha20_ietf_KEYBYTES
).