2 -- crypt() and gen_salt(): crypt-des
4 SELECT crypt('', 'NB');
10 SELECT crypt('foox', 'NB');
16 -- We are supposed to pass in a 2-character salt.
17 -- error since salt is too short:
18 SELECT crypt('password', 'a');
20 CREATE TABLE ctest (data text, res text, salt text);
21 INSERT INTO ctest VALUES ('password', '', '');
22 UPDATE ctest SET salt = gen_salt('des');
23 UPDATE ctest SET res = crypt(data, salt);
24 SELECT res = crypt(data, res) AS "worked"
31 -- check disabling of built in crypto functions
32 SET pgcrypto.builtin_crypto_enabled = off;
33 UPDATE ctest SET salt = gen_salt('des');
34 ERROR: use of built-in crypto functions is disabled
35 UPDATE ctest SET res = crypt(data, salt);
36 ERROR: use of built-in crypto functions is disabled
37 RESET pgcrypto.builtin_crypto_enabled;