# signature { license=0, seed=457995617, key="2670637986de41a294ef88a3c18f12f5" }
local _M = require"md5.core"
local gsub, format, byte = string.gsub, string.format, string.byte 
---
-- @param k String 
-- @return String converted to hexadecimal digits

function _M.hex(k)
  return (gsub(k, ".", function (c)
           return format("%02x", byte(c))
         end))
end

function _M.md5(msg,hex)
	local sum = _M.sum(msg)
	if hex then return _M.hex( sum) end
	return sum
end

setmetatable(_M, {__call = function(_,msg,hex) return _M.md5(msg,hex) end })
_M.BLOCK_SIZE = 64
_M._VERSION = "md5 1.0.3"
return _M
