We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the same key and the same mesg, but the result is different, why? lua: local key = "1" local mesg = "2"
local aes_256_cbc_sha1x5 = aes:new(key, salt, aes.cipher(256,"cbc"), aes.hash.sha1, 5) local encrypted = aes_256_cbc_sha1x5:encrypt(mesg) ngx.say("AES 256 CBC (SHA-1, salted) Encrypted HEX: ", str.to_hex(encrypted))
AES 256 CBC (SHA-1, salted) Encrypted HEX: 619a1da54b6c5113eb335a74296fed54
c++: int i, nrounds = 5; unsigned char key[32], iv[32];
i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), NULL, key_data, key_data_len, nrounds, key, iv);
... hex:1671d15e1905d518201b35064043cb71
to_hex api invoke ngx_hex_dump, it developed by C , same to my own c++ coding, but the result's display is different, Why???
The text was updated successfully, but these errors were encountered:
@peak1860 In Lua, strings are not null-terminated as in C or C++. This is likely where the difference is coming from.
Sorry, something went wrong.
No branches or pull requests
the same key and the same mesg, but the result is different, why?
lua:
local key = "1"
local mesg = "2"
local aes_256_cbc_sha1x5 = aes:new(key, salt, aes.cipher(256,"cbc"), aes.hash.sha1, 5)
local encrypted = aes_256_cbc_sha1x5:encrypt(mesg)
ngx.say("AES 256 CBC (SHA-1, salted) Encrypted HEX: ", str.to_hex(encrypted))
AES 256 CBC (SHA-1, salted) Encrypted HEX: 619a1da54b6c5113eb335a74296fed54
c++:
int i, nrounds = 5;
unsigned char key[32], iv[32];
...
hex:1671d15e1905d518201b35064043cb71
to_hex api invoke ngx_hex_dump, it developed by C , same to my own c++ coding, but the result's display is different, Why???
The text was updated successfully, but these errors were encountered: