1--
2-- init pgcrypto
3--
4CREATE EXTENSION pgcrypto;
5-- ensure consistent test output regardless of the default bytea format
6SET bytea_output TO escape;
7-- check for encoding fn's
8SELECT encode('foo', 'hex');
9 encode
10--------
11 666f6f
12(1 row)
13
14SELECT decode('666f6f', 'hex');
15 decode
16--------
17 foo
18(1 row)
19
20-- check error handling
21select gen_salt('foo');
22ERROR:  gen_salt: Unknown salt algorithm
23select digest('foo', 'foo');
24ERROR:  Cannot use "foo": No such hash algorithm
25select hmac('foo', 'foo', 'foo');
26ERROR:  Cannot use "foo": No such hash algorithm
27select encrypt('foo', 'foo', 'foo');
28ERROR:  Cannot use "foo": No such cipher algorithm
29