Skip to content
New issue

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

lua: expose hashing functions to lua - v2 #12449

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jasonish
Copy link
Member

Exposes SHA-256, SHA-1, and MD5 to Lua scripts via require "suricata.hashing".

Ticket: https://redmine.openinfosecfoundation.org/issues/7073

SV_BRANCH=OISF/suricata-verify#2247

Make all the hasher's have the same variants:
- add hex digest for sha256
- add finalize to hex for sha1
- add hex digest for sha1
Expose md5, sha1, and sha256 to Lua scripts with
`require("suricata.hashing")`.

Ticket: 7073
``sha1()``
^^^^^^^^^^

Returns a SHA-1 hasher that can updated multiple times, for example::
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns a SHA-1 hasher that can updated multiple times, for example::
Returns a SHA-1 hasher that can be updated multiple times, for example::


* ``update(string)``: Add more data to the hasher
* ``finalize()``: Finalize the hash returning the hash as a byte string
* ``finalize_to_hex()``: Finalize the hash returning the has as a hex string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* ``finalize_to_hex()``: Finalize the hash returning the has as a hex string
* ``finalize_to_hex()``: Finalize the hash returning the hash as a hex string

``md5()``
^^^^^^^^^

Returns a MD5 hasher that can updated multiple times, for example::
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns a MD5 hasher that can updated multiple times, for example::
Returns a MD5 hasher that can be updated multiple times, for example::

=============

Suricata provides Lua extensions, or libraries to Lua scripts with the
``require`` keyword. These extensions are particular important in Lua
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
``require`` keyword. These extensions are particular important in Lua
``require`` keyword. These extensions are particularly important in Lua

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24320

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants