Example
Below is a sample displaying the basic use of the library.
local crypto = require("crypto")
local evp = require("crypto.evp")
local hmac = require("crypto.hmac")
assert(io.input(some_file))
local md5_of_some_file = evp.digest("md5", io.read("*all"))
assert(io.input(some_file))
local hmac_of_some_file = hmac.digest("sha1", io.read("*all"), "hmackey")
And here is a sample of the object interface to the code.
require("crypto")
local evp = crypto.evp.new("md5")
for line in io.lines(some_file) do
evp:update(line)
end
local md5_of_some_file = evp:digest()