Skip to content

Support for other openssl algorithms in crypto functions #1037

@alsastre

Description

@alsastre

Is your feature request related to a problem? Please describe

When working with crypto functions like createHash I would like to support the same algorithms that the underlying openssl supports.

In my current container I can do:

echo "test" | openssl dgst -sha3-256 -hex -r

But nginx reports:

js exception: TypeError: not supported algorithm: "sha3-256"
    at createHash (native)
    at hash_token (/etc/nginx/njs/hashtoken.js:4)

Describe the solution you'd like

JS code I want to run:

return require('crypto').createHash('sha3-256')
                            .update(r.variables.api_key).update(r.variables.hash_secret)
                            .digest('hex');

Additional context

Nginx version: nginx/1.29.6

built by gcc 14.2.0 (Debian 14.2.0-19)
OS: Linux 6.12.76-linuxkit

njs:0.9.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions