From AOLserver Wiki
Jump to: navigation, search

nsmhash 1.1

Created by Richard Kotal.

This is AOLserver module that implements interface to mhash library (http://mhash.sourceforge.net).

  • (nsmhash 1.0) tested with 0.9.4 version of mhash library
  • support a lot of HASH and HMAC algorithms (MD5, SHA1, RIPEMD, GOST, ...)
  • support key generator algorithms (MCRYPT, HEX, ...)
  • work with nsv_*. HASH object may be shared.
  • HASH object may be serialize and save to file, db, ...

Download page, nsmhash-1.1.tgz

Simple samples:

   [ns_mhash keygen create MCRYPT "Hello world" [list MD5] 10]
   result: 3e25960a79dbc69b674c

   set td [ns_mhash hash new MD5]
   ns_mhash hash update $td "Hello world"
   set hash [ns_mhash hash end $td]
   ns_adp_puts $hash
   result: 3e25960a79dbc69b674cd4ec67a72c62

   set td [ns_mhash hmac new MD5 "password"]
   ns_mhash hmac update $td "Hello world"
   set hmac [ns_mhash hmac end -base64 $td]
   ns_adp_puts $hmac
   result: MyPQK3X37QIxu6NfSOK68g==