Hosting without pgcrypto functions. There are other solutions?

Started by Andre Lopesalmost 16 years ago3 messagesgeneral
Jump to latest
#1Andre Lopes
lopes80andre@gmail.com

Hi,

I have an account in A2Hosting.com, and I'm developing some functions that
deal with encryption.

A2Hosting.com don't have available the function "digest()"

[code]
ERROR: function digest(unknown, unknown) does not exist
LINE 1: select digest('ffff', 'sha1')
^
HINT: No function matches the given name and argument types. You might need
to add explicit type casts.

Indicação de entrada :
select digest('ffff', 'sha1')
[/code]

I need to compile a SHA1 function, but without the digest() function,
nothing done...

[code]
CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
SELECT encode(digest($1, 'sha1'), 'hex')
$$ LANGUAGE SQL STRICT IMMUTABLE;
[/code]

There is a way to get this job done without the digest() function?

I need also to be able to do this select "select substr(gen_salt('md5'), 0,
10)" but there is no "gen_salt()" available...

What is my best option? To change hosting account? There is some hosting
accounts with this functions available in the Postgre?

Best Regards,

#2Merlin Moncure
mmoncure@gmail.com
In reply to: Andre Lopes (#1)
Re: Hosting without pgcrypto functions. There are other solutions?

On Sun, Jun 13, 2010 at 4:37 PM, Andre Lopes <lopes80andre@gmail.com> wrote:

Hi,

I have an account in A2Hosting.com, and I'm developing some functions that
deal with encryption.

A2Hosting.com don't have available the function "digest()"

[code]
ERROR:  function digest(unknown, unknown) does not exist
LINE 1: select digest('ffff', 'sha1')

I bet the crypto library is built/installed -- you just need to
install the functions. Try this:
CREATE OR REPLACE FUNCTION digest(text, text)
AS '$libdir/pgcrypto', 'pg_digest'

If that fails then start thinking about plan 'B'.

merlin

#3John Gage
jsmgage@numericable.fr
In reply to: Merlin Moncure (#2)
Re: Hosting without pgcrypto functions. There are other solutions?

Have you talked to A2 about this? They are very good about installing
things.

John

On Jun 14, 2010, at 3:20 PM, Merlin Moncure wrote:

Show quoted text

On Sun, Jun 13, 2010 at 4:37 PM, Andre Lopes
<lopes80andre@gmail.com> wrote:

Hi,

I have an account in A2Hosting.com, and I'm developing some
functions that
deal with encryption.

A2Hosting.com don't have available the function "digest()"