suricata
util-lua-hashlib.c File Reference
#include "util-lua-hashlib.h"
#include "lauxlib.h"
#include "rust-bindings.h"
Include dependency graph for util-lua-hashlib.c:

Go to the source code of this file.

Macros

#define SHA256_MT   "suricata:hashlib:sha256"
 
#define SHA1_MT   "suricata:hashlib:sha1"
 
#define MD5_MT   "suricata:hashlib:md5"
 

Functions

int SCLuaLoadHashlib (lua_State *L)
 

Detailed Description

Hashing library for Lua.

Usage:

local hashing = require("suricata.hashing")

– One shot hash hash = hashing.sha256_digest("www.suricata.io")

– One shot hash to hex hash = hashing.sha256_hexdigest("www.suricata.io")

– Incremental hashing hasher = hashing.sha256() hasher:update("www.") hasher:update("suricata.io") hash = hasher:finalize()

Support hashes: sha256, sha1, md5

Definition in file util-lua-hashlib.c.

Macro Definition Documentation

◆ MD5_MT

#define MD5_MT   "suricata:hashlib:md5"

Definition at line 50 of file util-lua-hashlib.c.

◆ SHA1_MT

#define SHA1_MT   "suricata:hashlib:sha1"

Definition at line 49 of file util-lua-hashlib.c.

◆ SHA256_MT

#define SHA256_MT   "suricata:hashlib:sha256"

Definition at line 48 of file util-lua-hashlib.c.

Function Documentation

◆ SCLuaLoadHashlib()

int SCLuaLoadHashlib ( lua_State L)

Definition at line 409 of file util-lua-hashlib.c.

References SHA256_MT.