Re: MD5 use in PL/Perl

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Marc Rassbach <marc(at)milestonerdl(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: MD5 use in PL/Perl
Date: 2000-12-28 21:54:24
Message-ID: Pine.LNX.4.30.0012282251020.1096-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Marc Rassbach writes:

> Attempting to xlate to PL/Perl
>
> settle=# create function md5out3(varchar) returns varchar(32) as '
> settle'# use MD5;
> settle'# my $mdval = new MD5;
> settle'# my $result ;
> settle'# my $out;
> settle'# $mdval->add($_[0]);
> settle'# $result = $mdval->digest();
> settle'# $out= unpack("H*" , $result );
> settle'# return $out;'
> settle-# LANGUAGE 'plperl';
> CREATE
> settle=# select md5out3('fred');
> ERROR: creation of function failed : require trapped by operation mask at
> (eval 6) line 2.

You can't use external modules ("use", "require") for security reasons.

FWIW, if I were to write an MD5 function then I'd take one of the
implementations floating around (mhash, Kerberos, OpenSSL, RFC) and make a
C function wrapper around it.

Incidentally, someone has already done this for the upcoming 7.1 release,
but since the function call interface has changed the back port won't be
trivial.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message jkakar 2000-12-28 22:00:46 How to trim values?
Previous Message Webb Sprague 2000-12-28 20:18:38 Simultaneous Connection Problem