I
https://github.com/zhaozg/lua-openssl
ну могу понять как спользовать aes-256-gcm
точнее не могу найти пример, мб есть у кого завалялся
Size: a a a
I
YG
local C = cipher.get(key.as_rs_alg)
local evp_cipher_ctx = C:encrypt_new()
evp_cipher_ctx:init(mac, key_realm)
local str = assert(evp_cipher_ctx:update(key.realm,true)) -- it fails here with UNKNOWN error
local str = assert(evp_cipher_ctx:update(key.ikm_key)) str = str..evp_cipher_ctx:final()
YG
YG
YG
YG
I
local C = cipher.get(key.as_rs_alg)
local evp_cipher_ctx = C:encrypt_new()
evp_cipher_ctx:init(mac, key_realm)
local str = assert(evp_cipher_ctx:update(key.realm,true)) -- it fails here with UNKNOWN error
local str = assert(evp_cipher_ctx:update(key.ikm_key)) str = str..evp_cipher_ctx:final()
YG
I
AS
YG
YG
MT
function createBtn(x,y,w,h,txt)Но кажется это не очень оптимальный код.
html = [[<div style="position:absolute; top:]]..y..[[; left:]]..x..[[vw; width:]]..w..[[vw; height: ]]..h..[[vh">]]..text..[[</div>]]
screen.setHTML(x,y,html)
return {x=x,y=y,x1=w+x,y1=h+y}
end
btn1 = createBtn(1,1,2,2, "Hello")
btn2 = createBtn(5,4,2,2, "Hello")
----вызывается при нажатии
if x<btn1.x and x<btn1.x1 and y > btn1.y and btn1.y1 then
--do
end
--- и все другие функции вызывать на остальные кнопки
ШТ
local buttons = {}
function createBtn(x,y,w,h,txt, handler)
html = [[<div style="position:absolute; top:]]..y..[[; left:]]..x..[[vw; width:]]..w..[[vw; height: ]]..h..[[vh">]]..text..[[</div>]]
screen.setHTML(x,y,html)
buttons[buttons + 1] = {x=x,y=y,x1=w+x,y1=h+y, handler = handler}
end
createBtn(1,1,2,2, "Hello", function() end)
createBtn(5,4,2,2, "Hello", function() end)
for _, but in pairs(buttons) do
if x<but.x and x<but.x1 and y > but.y and but.y1 then
but.handler()
end
endШТ
MT
local buttons = {}
function createBtn(x,y,w,h,txt, handler)
html = [[<div style="position:absolute; top:]]..y..[[; left:]]..x..[[vw; width:]]..w..[[vw; height: ]]..h..[[vh">]]..text..[[</div>]]
screen.setHTML(x,y,html)
buttons[buttons + 1] = {x=x,y=y,x1=w+x,y1=h+y, handler = handler}
end
createBtn(1,1,2,2, "Hello", function() end)
createBtn(5,4,2,2, "Hello", function() end)
for _, but in pairs(buttons) do
if x<but.x and x<but.x1 and y > but.y and but.y1 then
but.handler()
end
endШТ
-- buttons.lua
local buttons = {}
function createBtn(x,y,w,h,txt, handler)
html = [[<div style="position:absolute; top:]]..y..[[; left:]]..x..[[vw; width:]]..w..[[vw; height: ]]..h..[[vh">]]..text..[[</div>]]
screen.setHTML(x,y,html)
buttons[buttons + 1] = {x=x,y=y,x1=w+x,y1=h+y, handler = handler}
end
for _, but in pairs(buttons) do
if x<but.x and x<but.x1 and y > but.y and but.y1 then
but.handler()
end
end
return { createBtn = createBtn }
-- other file
local createBtn = require "buttons".createBtn
createBtn(1,1,2,2, "Hello", function() end)
createBtn(5,4,2,2, "Hello", function() end)ШТ
MT