2 -- crypt() and gen_salt(): extended des
4 SELECT crypt('', '_J9..j2zz');
10 SELECT crypt('foox', '_J9..j2zz');
12 ----------------------
16 -- check XDES handling of keys longer than 8 chars
17 SELECT crypt('longlongpassword', '_J9..j2zz');
19 ----------------------
23 -- error, salt too short
24 SELECT crypt('foox', '_J9..BWH');
26 -- error, count specified in the second argument is 0
27 SELECT crypt('password', '_........');
28 ERROR: crypt(3) returned NULL
29 -- error, count will wind up still being 0 due to invalid encoding
30 -- of the count: only chars ``./0-9A-Za-z' are valid
31 SELECT crypt('password', '_..!!!!!!');
32 ERROR: crypt(3) returned NULL
33 -- count should be non-zero here, will work
34 SELECT crypt('password', '_/!!!!!!!');
36 ----------------------
40 CREATE TABLE ctest (data text, res text, salt text);
41 INSERT INTO ctest VALUES ('password', '', '');
42 UPDATE ctest SET salt = gen_salt('xdes', 1001);
43 UPDATE ctest SET res = crypt(data, salt);
44 SELECT res = crypt(data, res) AS "worked"