summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luamd5/md5.lua
blob: 0e0c4912dd9b8f8a826b70ccd4852de93904e137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- md5.lua
-- (you should put this file in any directory of your LUA_PATH)


-- change the next line to point to the md5 dynamic library

-- local path = "/usr/local/lua/lib/libmd5.so"
--local path = "./libmd5.so"

--assert(loadlib(path, "luaopen_md5"))()


-- Returns the md5 hash value as a string of hexadecimal digits

function md5.sumhexa (k)
  k = md5.sum(k)
  return (string.gsub(k, ".", function (c)
           return string.format("%02x", string.byte(c))
         end))
end

return md5