openresty / openresty/lua-resty-string
how to implement aes-128-ecb encryption with php or golang
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 443
- Forks
- 143
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the shown resty.aes configuration with the PHP openssl_encrypt call, including the AES mode, key, padding, and base64 handling. Reproduce both outputs and determine whether the differing ciphertext is caused by mismatched options; done means documenting the equivalent configuration or the remaining incompatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, php
- Domain
- cryptography
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100