Skip to content

how to implement aes-128-ecb encryption with php or golang #95

@Doraemonoops

Description

@Doraemonoops

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions