Debian Codegraph @

contrib/pgcrypto/sql/crypt-xdes.sql

raw
1 --
2 -- crypt() and gen_salt(): extended des
3 --
4
5 SELECT crypt('', '_J9..j2zz');
6
7 SELECT crypt('foox', '_J9..j2zz');
8
9 -- check XDES handling of keys longer than 8 chars
10 SELECT crypt('longlongpassword', '_J9..j2zz');
11
12 -- error, salt too short
13 SELECT crypt('foox', '_J9..BWH');
14
15 -- error, count specified in the second argument is 0
16 SELECT crypt('password', '_........');
17
18 -- error, count will wind up still being 0 due to invalid encoding
19 -- of the count: only chars ``./0-9A-Za-z' are valid
20 SELECT crypt('password', '_..!!!!!!');
21
22 -- count should be non-zero here, will work
23 SELECT crypt('password', '_/!!!!!!!');
24
25 CREATE TABLE ctest (data text, res text, salt text);
26 INSERT INTO ctest VALUES ('password', '', '');
27
28 UPDATE ctest SET salt = gen_salt('xdes', 1001);
29 UPDATE ctest SET res = crypt(data, salt);
30 SELECT res = crypt(data, res) AS "worked"
31 FROM ctest;
32
33 DROP TABLE ctest;