lua-users home
lua-l archive

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

Hi all,

I am happy to announce the version 0.5 of my Pure Lua Crypto project (PLC) [1]


PLC is a collection of cryptographic algorithms written in pure Lua
5.3 with no external Lua or C dependency.

I tried to pay some attention to the performance. This is pure Lua so
we are far from C or ASM speed, but at more than 1 Mbyte/s encryption
speed on an average laptop, it can be useful in several contexts - See
some perf figures below.

Since my last announcement, the major additions have been contributed
by Pierre Chapuis ('catwell'):

- Salsa20 stream encryption,

- the NaCl secretbox function for authenticated encryption (based on
Salsa20 and a Poly1305 MAC)

- the NaCl box function for public key encryption (based on
ECDH/ec25519 key exchange and secretbox authenticated encryption)

- a rockspec (and some help!), so PLC can now be installed with
  `luarocks install plc`

PLC also includes:

- Norx, a very fast, modern authenticated encryption algorithm with associated
data (AEAD) - 256-bit key and nonce.

- Blake2b - A strong crypto hash function, specified in RFC 7693. Much faster
than SHA-3.

- Chacha20 stream encryption and Poly1305 MAC as specified in RFC 7539

- Rabbit, a fast stream cipher (128-bit key, 64-bit IV)

- XTea block cipher (a more secure evolution of TEA)

- Elliptic curve scalar multiplication based on ec25519 (enough to
implement a DH key exchange - used in the new NaCl box function)

- SHA2-256, SHA3-256 and -512

- RC4, MD5 for legacy applications

- and some non-cryptographic utilities: Hex, Base64, and Base58
encoding/decoding, CRC-32 and Adler-32 checksum

--- Performance ---

The following are approximate elapsed times (in sec.) to hash or
encrypt a 10-megabyte string (on a laptop with an i5 M430 CPU at 2.27

  4s  norx (full AEAD)
  5s  rabbit
  9s  chacha20
  11s chacha20+poly1305 AEAD
  8s  rc4

  9s  blake2b (512-bit hash)
  17s sha2-256
  43s sha3-512

More at  See also the test_perf.lua file.

For C-level crypto performance, see also my C extension library luazen [2]


All suggestions, bug reports and contributions are welcome.