-local function readdump(infile)
- t = infile:read("*all")
- --print(string.len(t))
- len = string.len(t)
- local len,hex = bin.unpack(("H%d"):format(len),t)
- --print(len,hex)
- return hex
-end
-local function convert_to_js(hexdata)
- if string.len(hexdata) % 32 ~= 0 then
- return oops(("Bad data, length should be a multiple of 32 (was %d)"):format(string.len(hexdata)))
- end
- local js,i = "[";
- for i = 1, string.len(hexdata),32 do
- js = js .."'" ..string.sub(hexdata,i,i+31).."',\n"
- end
- js = js .. "]"
- return js
-end
-