Re: MD5 use in PL/Perl - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: MD5 use in PL/Perl
Date
Msg-id Pine.LNX.4.30.0012282251020.1096-100000@peter.localdomain
Whole thread Raw
In response to MD5 use in PL/Perl  (Marc Rassbach <marc@milestonerdl.com>)
List 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@gmx.net       http://yi.org/peter-e/



pgsql-sql by date:

Previous
From: Marc Rassbach
Date:
Subject: MD5 use in PL/Perl
Next
From: jkakar@expressus.com
Date:
Subject: How to trim values?