08.08.2017, 08:50
Here's a basic SSL connection example:
Checksum calculation:
Code:
socket = require('socket')
ssl = require('ssl')
ip = '192.168.1.1'
port = 2601
sock = socket.tcp()
sock:settimeout(5)
sock:connect(ip, port)
sock = ssl.wrap(sock, 'tlsv1')
sock:dohandshake()
Checksum calculation:
Code:
function checksum(str)
local sum = 0
for i = 1, #str do
sum = (sum + str:byte(i)) % 256
end
return string.format('%02X', 256 - sum)
end