Re: pgcryto strangeness...

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: Bear Giles <bear(at)coyotesong(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgcryto strangeness...
Date: 2002-01-05 19:11:10
Message-ID: 20020105111110.T36993@ninja1.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> > host=# SELECT DIGEST('asdf', 'md5') FROM users_shadow;
> > digest
> > ------------------------------------------------
> > \221.\310\003\262\316I\344\245A\006\215IZ\265p
> > (1 row)
>
> You must encode() the results.

Sorry for not being more clear, this isn't the problem: just proof
that things are working on this end.

> (For the record, I consider that a serious design flaw.
> It may not be possible to safely dump and restore tables
> containing unencoded 8-bit data.)

How about a digest_hex() method?

> > host=# SELECT DIGEST(password, 'md5') FROM users_shadow;
> > ERROR: Function 'digest(varchar, unknown)' does not exist
> > Unable to identify a function that satisfies the given argument types
> > You may need to add explicit typecasts
> > host=# SELECT DIGEST(CAST(password AS bytea), CAST('md5' AS TEXT)) FROM users_shadow;
> > ERROR: Cannot cast type 'varchar' to 'bytea'
>
> Try dropping the first cast.

Already have. I've cast it to text too. I've even tried having it
operate on char and text column types, it's looking for a bytea data
type, but I don't know how to cast to that correctly and that's the
problem (with the module?). Sorry I wasn't more explicitly earlier. -sc

host=# SELECT DIGEST(CAST(enabled AS bytea), CAST('md5' AS TEXT)) FROM users_shadow;
ERROR: Cannot cast type 'bpchar' to 'bytea'
host=# SELECT DIGEST(CAST(enabled AS text), CAST('md5' AS TEXT)) FROM users_shadow;
ERROR: Function 'digest(text, text)' does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts
host=# SELECT DIGEST(CAST(password AS text), CAST('md5' AS TEXT)) FROM users_shadow;
ERROR: Function 'digest(text, text)' does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

--
Sean Chittenden

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2002-01-05 19:12:09 Re: RC1 time?
Previous Message Tom Lane 2002-01-05 19:01:04 Re: Some interesting results from tweaking spinlocks

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-01-05 19:56:43 Re: pgcryto strangeness...
Previous Message Bear Giles 2002-01-05 15:46:38 Re: pgcryto strangeness...