lua-resty-string
lua-resty-string copied to clipboard
how to implement aes-128-ecb encryption with php or golang
here is the lua code
local aes = require 'resty.aes'
local cipher = aes:new('0123456789123456', nil, aes.cipher(128, 'ecb'))
print(ngx.encode_base64(cipher:encrypt('foobar')))
the output should be rTeNAHEZtzsyn1dDAujGgQ==
blow is my php code
var_dump(base64_encode(openssl_encrypt('foobar', 'aes-128-ecb', '0123456789123456', OPENSSL_RAW_DATA)));
the output should be AIIiZT3RO/bkseLE0Mcopg==
how can i get the lua result with php code. pls help me, thanks.
local cipher = aes:new('0123456789123456', nil, aes.cipher(128, 'ecb'),{ iv ='\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'})
抱歉我一般不看Gmail,我用的是QQ邮箱,若你要联系我,请加我微信:a1657917789 我的qq:3113143666
shangwing @.***>于2024年3月26日 周二15:31写道:
local cipher = aes:new('0123456789123456', nil, aes.cipher(128, 'ecb'),{ iv ='\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'})
— Reply to this email directly, view it on GitHub https://github.com/openresty/lua-resty-string/issues/95#issuecomment-2019562365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5TE7ZZRCQOMW7A232OR7LY2EP6PAVCNFSM6AAAAAAZPYNHI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJZGU3DEMZWGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>