Nsmcrypt

From AOLserver Wiki
Jump to navigation Jump to search

nsmcrypt 1.0

Created by Richard Kotal.


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

  • tested with 2.5.7 version of mcrypt library
  • support a lot of crypt algorithms (des, blowfish, rijndael, ...)
  • support a lot of cipher mode (cbc, cfb, stream, ...)
  • work with nsv_*. CRYPT object may be shared.


Download page, nsmcrypt-1.0.tgz


Simple sample:

   set td [ns_mcrypt new "rijndael-256" "ncfb"]
   ns_mcrypt initvector set -hex $td "ab325897ffde"
   ns_mcrypt init $td "foo"
   set ctxt [ns_mcrypt crypt -in raw -out hex $td "foofoo"]
   ns_mcrypt flush $td 
   ns_adp_puts "cipher text (hex string): $ctxt"
   set detachid [ns_mcrypt detach $td]
   nsv_set test test $detachid
   set id [nsv_get test test]
   set td [ns_mcrypt attach $id]
   ns_mcrypt init $td "foo"
   set ptxt [ns_mcrypt decrypt -in hex -out raw $td $ctxt]
   ns_mcrypt destroy $td
   ns_adp_puts plain decrypted text: $ptxt
   result:
   cipher text (hex string): d84d40f267c0
   plain decrypted text: foofoo