lua-users home
lua-l archive

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


You could use a full Lua OpenSSL wrapper for this, if this dependency is acceptable to you.

It was not for one of my projects, so I have my collection of algorithms here:
https://github.com/bel2125/LuaPortable4Windows/tree/main/src/crypto-algorithms
It is based on a public domain C implementation offering CRC, MD2, MD5, SHA1, SHA256, AES, DES, BLOWFISH, RC4 wrapped to Lua. The selection was made based on the license and a minimalistic code base without dependencies. You could take this directory as the hash library (and ignore the rest of the repository).

In contrast, a pure Lua implementation would avoid the need of a C library completely, and from the performance point of view it's only relevant for large data.



On Thu, Oct 28, 2021 at 6:16 PM Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> Are there any good collections of hash function in a C based Lua lib?
>
> Usual stuff like bcrypt, the SHA2 family, and maybe some more modern
> functions too.

Try lua-hashings, which is in pure Lua:
 https://luarocks.org/modules/user-none/lua-hashings

See also https://luarocks.org/search?q=crypto

There's also my ldigest at https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#ldigest