1 local s_char = string.char;
3 local function char_to_hex(c)
4 return ("%02x"):format(c:byte())
7 local function hex_to_char(h)
8 return s_char(tonumber(h, 16));
12 return s:gsub(".", char_to_hex);
15 local function from(s)
16 return s:gsub("..", hex_to_char);
19 return { to = to, from = from }