Re: Random strings

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Joe Conway <joseph(dot)conway(at)home(dot)com>
Cc: "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Random strings
Date: 2001-08-08 19:21:09
Message-ID: Pine.LNX.4.30.0108082119310.692-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Joe Conway writes:

> Per the discussion yesterday, here's a patch. There are two versions of
> essentially the same function. They both take an int as the number of
> requested random bytes, and generate a random binary string of the requested
> length from /dev/urandom. The first one (randomstr_hex) converts the binary
> to hex and returns it as text, and the other (randomstr_bytea) does the
> needed escaping of special characters and returns bytea.

Perhaps one of these returning bytea would be enough and you can use
the new encode functions to convert them to a format of choice. Also, why
aren't you using /dev/random?

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-08-08 19:21:53 Re: [GENERAL] Bug with ALTER TABLE
Previous Message Allan Engelhardt 2001-08-08 19:13:24 Re: Re: Still wondering about random numbers...

Browse pgsql-patches by date

  From Date Subject
Next Message Anders Bengtsson 2001-08-08 20:03:40 JDBC Statement cleanup patch
Previous Message Allan Engelhardt 2001-08-08 19:13:24 Re: Re: Still wondering about random numbers...