lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi all,

LuaNacha ("NaCl with Chacha20") is a small Lua crypto library [1]
based on the excellent Monocypher C library by Loup Vaillant [2]



Monocypher is itself heavily based on the NaCl crypto library by
Daniel Bernstein and Tanja Lange.

Major features and differences with the NaCl library:

* Authenticated encryption with Chacha20 stream encryption (more
precisely Xchacha20, ie. Chacha with a 24-byte nonce) and Poly1305
MAC. Chacha20 is the successor of NaCl Salsa20. It has been adopted
for TLS and SSH.

* Curve25519-based key exchange and public key encryption (same as NaCl)

* Blake2b hash function, a very good and very fast cryptographic hash
function. It may generate a digest of any size (from 1 to 64).  With a
64-byte digest, the performance is better (1.4X) than SHA-512 for
similarly optimized versions. This implementation is much better than
the Tweet NaCl SHA-512 (more than 15X faster)

* Ed25519-based signature function using Blake2b hash instead of sha512,

* Argon2i, a modern key derivation function based on Blake2b. Like
scrypt, it is designed to be expensive in both CPU and memory.

This Lua library is small:,  including all the crypto
code, is only 35 KB.

It is available at:

To build:
  - adjust the Makefile and run 'make'
  - or pass the Lua paths on le make line:
        make LUA=/path/to/lua LUAINC=/path/to/lua_include_dir test

(a rockspec is due...)

The binding has been built and tested on Linux with Lua-5.3.3,
Lua-5.2.4 and Lua-5.1.5

A very limited test file is provided ("test_luanacha.lua")

License: MIT (see the License section in the readme file)

All suggestions, bug reports and contributions are welcome.