Lua-MD5

Overview

MD5 offers basic cryptographic facilities for Lua 5.1: a hash (digest) function, a pair crypt/decrypt based on MD5 and CFB, and a pair crypt/decrypt based on DES with 56-bit keys.
MD5 is free software and uses the same license as Lua.

Download

A Windows precompiled version of MD5 can be found at its LuaForge page (see more information link)

Installation

Here is how to make the MD5 Lua module available to your AutoPlay Media Studio 8.0 project.
1. Download the Lua module and extract it to a temporary location.
2. Copy the md5.lua file to your project's Scripts folder. (Do not place it in a lua subfolder; put it directly inside the Scripts folder.)
3. Copy the contents of the lib folder to your project's Scripts folder. You need the des56.dll in the Scripts folder, and the core.dll in Scripts\md5.
4. Add the following requires to your project, e.g. in Global Functions:

require"md5" -- for the md5.sumhexa() function

require"md5.core" -- for the other md5 functions

require"des56" -- for the des56 functions


Usage
The functions are documented here: http://www.keplerproject.org/md5/manual.html#reference
Note that although the 'key' you pass to the crypt and decrypt functions is described as a 'binary string,' it only seems to work if you pass a numeric value up to 56 bits in length, e.g. a number no larger than 72057594037927935.

Example

require"des56"

local encrypted = des56.crypt("My top secret message", 123456);

local decrypted = des56.decrypt(encrypted, 123456);

assert(decrypted == "My top secret message");

Credits
This Lua version of MD5 was designed and implemented by Roberto Ierusalimschy and Marcela Oz?rio Suarez (based on the original MD5 by Ron Rivest). The DES 56 C library was implemented by Stuart Levy and uses a MIT license too. The current distribution was packed by Tom?s Guisasola and F?bio Mascarenhas as part of the Kepler Project. @

0 comments:

Post a Comment