diff --git a/docs/scripting.xml b/docs/scripting.xml
index d471c9e93..8e95b97bc 100644
--- a/docs/scripting.xml
+++ b/docs/scripting.xml
@@ -4303,21 +4303,22 @@ The mainloop function will work on each runlevel grouping of threads in order.
- Two of the smaller compiled modules that come with NSE are
- bitbit NSE module
- and hash,hash NSE module
- and they serve as good examples of how to write such modules. The
+ The smallest compiled modules that comes with NSE is
+ bit,bit NSE module
+ and one of the most straightforward is
+ openssl.openssl NSE module
+ These modules serve as good examples for a beginning module
+ writer. The
source code for bit is in the files
nse_bit.cc and
nse_bit.h, and likewise the source for
- hash is in nse_hash.cc and
- nse_hash.h. The other compiled modules follow
- this naming convention.
+ openssl is in nse_openssl.cc and
+ nse_openssl.h. The other compiled modules
+ usually follow this naming convention.
-
- Let us look at the hash module. One of the
- functions in nse_hash.cc is
+ Let us look at the openssl module. One of the
+ functions in nse_openssl.cc is
l_md5, which calculates an MD5 digest. Its
function prototype is
@@ -4331,25 +4332,27 @@ static int l_md5(lua_State *L);
luaL_reg and associated with the name
md5, the name it will be known by to NSE:
-static const luaL_reg hashlib[] =
-{
- {"md5", l_md5},
- {NULL, NULL}
+static const struct luaL_reg openssllib[] = {
+ { "md5", l_md5 },
+ { NULL, NULL }
};
Then the library is registered with a call to
luaL_register inside the initialization
- function luaopen_hashlib:
+ function luaopen_openssl. Some lines relating
+ to the registration of OpenSSL BIGNUM types have been
+ omitted.
-LUALIB_API int luaopen_hashlib (lua_State *L) {
- luaL_register(L, NSE_HASHLIBNAME, hashlib);
+LUALIB_API int luaopen_openssl(lua_State *L) {
+ luaL_register(L, OPENSSLLIBNAME, openssllib);
return 1;
}
- (NSE_HASHLIBNAME is just the string
- "hash".) luaopen_hashlib
+ (NSE_OPENSSLLIBNAME is just the string
+ "openssl", the name of the module.)
+ luaopen_openssl
is the only function in the file that is exposed in
- nse_hash.h.
+ nse_openssl.h.