forked from subnoize417/C4-AndroidTV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.lua
38 lines (31 loc) · 857 Bytes
/
helpers.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function PrintHex(data)
print(GetHexString(data))
end
function GetHexString(data)
local output = "";
for i = 1, #data do
char = string.sub(data, i, i)
output = output .. string.format("%02X", string.byte(char)) .. " "
end
return output
end
function PrintDecimal(data)
print(GetDecimalString(data))
end
function GetDecimalString(data)
local output = "";
for i = 1, #data do
char = string.sub(data, i, i)
output = output .. string.format("%d", string.byte(char)) .. " "
end
return output
end
function Int32ToBytes(val)
return string.char((val / (256*256*256)) % 256) .. string.char((val / (256*256)) % 256) .. string.char((val / (256)) % 256) .. string.char(DriverPublicKeyExponent % 256)
end
function RemoveLeadingZeros(data)
if(#data > 0 and data:byte(1) == 0) then
return RemoveLeadingZeros(data:sub(2))
end
return data
end