util/paseto.lua
changeset 12720 0b68b021ce46
parent 12717 52eead170bb8
child 12842 2e71b76ac299
equal deleted inserted replaced
12719:5dd00f806e32 12720:0b68b021ce46
    21 local function le64(n)
    21 local function le64(n)
    22 	return s_pack("<I8", bit.band(n, 0x7F));
    22 	return s_pack("<I8", bit.band(n, 0x7F));
    23 end
    23 end
    24 
    24 
    25 local function pae(parts)
    25 local function pae(parts)
       
    26 	if type(parts) ~= "table" then
       
    27 		error("bad argument #1 to 'pae' (table expected, got "..type(parts)..")");
       
    28 	end
    26 	local o = { le64(#parts) };
    29 	local o = { le64(#parts) };
    27 	for _, part in ipairs(parts) do
    30 	for _, part in ipairs(parts) do
    28 		table.insert(o, le64(#part)..part);
    31 		table.insert(o, le64(#part)..part);
    29 	end
    32 	end
    30 	return table.concat(o);
    33 	return table.concat(o);