Table of Contents
This project provides Lua bindings for the OpenSSL crypto libraries. libcrypto provides digest functions, such as MD5, SHA-1, and HMAC; cipher functions, such as RC5 and Blowfish; public key crypto, such as RSA and Diffie-Hellman; and some other assorted tools (i.e. random number generation).
Currently only the digest functions are mapped by this Lua binding.
The latest version of luacrypto is 0.1.1, written by Keith Howe <email@example.com>
- Lua 5.x - http://www.lua.org/: luacrypto uses the new Lua 5.1 package system. It will also work with Lua 5.0 using the included Compat-5.1 emulation system.
- libcrypto 0.9.7+ - http://www.openssl.org/: luacrypto has only been built against and tested with OpenSSL versions 0.9.7 and above. It depends on additional API methods introduced in 0.9.7.
Edit the "config" file and set the following fields to the correct values for your environment:
- LUAINC: The location of your Lua include headers. This is required to build the code.
- LUA_PATH: The installation path for your system independent Lua files.
- LUA_CPATH: The installation path for your system dependent Lua files. This and LUA_PATH are required to install the libraries properly.
- USE_COMPAT: Set this if your target environment is Lua 5.0. If your target is Lua 5.1, leave this blank. (Note that the compat-5.1.lua module must be loaded before any wrapped modules will work. See the Compat 5.1 page for details).
- INSTALL_COMPAT: If you have set USE_COMPAT, you should also set this value to install the compat-5.1.lua module during "make install". However, if you already have the module installed (and possibly customised), leave this unset to keep it from being clobbered during "make install".
- LUA_TYPE: Set this to the type of Lua libraries you would like to install; either "lc" for precompiled Lua libraries (using luac), or "lua" for regular text Lua libraries.
- LUA: The location of your Lua interpreter; only needed to run the test suite.
- LUAC: The location of your Lua compiler; only needed to build the precompiled Lua libraries (LUA_TYPE = lc).
- CRYPTOLIB: On most systems, the default value will be fine. However, if your OpenSSL libcrypto library is not in the standard library paths, you may need to point this at your OpenSSL install.
- CRYPTOINC: On most systems, the default value will be fine. However, if your OpenSSL libcrypto headers are not in the standard include paths, you may need to point this at your OpenSSL install.
Once configured, run make to build the libraries. Run make install to install the libraries in the correct location. The install will run a test suite if you have set the location of your Lua interpreter. You can run the tests independently with make tests, but you cannot run the tests until after you have run make install.
Much of this code was heavily inspired by and/or lifted directly from the lmd5 project, written by Luiz Henrique de Figueiredo <firstname.lastname@example.org>.
The Compat-5.1 library written by the folks at the Kepler Project is also included for Lua 5.0 support.
See the documentation for more info.