slang-users mailing list

[2012 Date Index] [2012 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] crypto module


Arik Mitschang <arik.mitschang@xxxxxxxxx> wrote:
> I needed and HMAC routine a bit ago and after searching around I
> noticed there was no module for cryptographic functions so I made one
> myself which wraps some of the OpenSSL EVP library functions. It
> provides the following:
>
> digest
> hmac
> _encrypt & encrypt
> _decrypt & decrypt
> _genkeyiv
> base64_encode
> base64_decode

FWIW, a base64 encoder/decoder was added to the development version of
slang 2.3.0 a while back.  Also the library includes a chksum module
may be used to compute sha1 and md5 sums.  Both modules share a
similar interface.

> And the included help file has info on all but the base64 functions
> (yet). I thought this might be of interest to others out there. One
> thing I ran across that I wasn't sure about was leaving items on the
> stack in the event of an error. For instance, the _encrypt function
> first pulls a single value off the stack corresponding to the
> symmetric cipher algorithm, if that doesn't exist it errors there
> leaving the rest on the stack. I did this so wouldn't have to load and
> free the other variables if they are certainly not going to be used.

That is ok; the values will remain on the stack as the interpreter
unwinds, and then will get removed if/when an exception handler is
invoked.

> Anyway, if you're interested the source is at:
>
> http://web.science.mq.edu.au/~arikm/code/slcrypto/slcrypto.tar.gz

I will add a link to it on <http://jedsoft.org/slang/modules/>.

Thanks,
--John



[2012 date index] [2012 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]