Skip site navigation (1) Skip section navigation (2)

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 (view raw or whole 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';
> 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

Peter Eisentraut      peter_e(at)gmx(dot)net

In response to

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group