Обсуждение: Hosting without pgcrypto functions. There are other solutions?

Поиск
Список
Период
Сортировка

Hosting without pgcrypto functions. There are other solutions?

От
Andre Lopes
Дата:
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,

Re: Hosting without pgcrypto functions. There are other solutions?

От
Merlin Moncure
Дата:
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

Re: Hosting without pgcrypto functions. There are other solutions?

От
John Gage
Дата:
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:

> 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()"
>>