summaryrefslogtreecommitdiffstats
path: root/contrib/pgcrypto/sql/crypt-md5.sql
blob: ba7befb22876c008e4a6f46dcd8e8adb698356bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--
-- crypt() and gen_salt(): md5
--

SELECT crypt('', '$1$Szzz0yzz');

SELECT crypt('foox', '$1$Szzz0yzz');

CREATE TABLE ctest (data text, res text, salt text);
INSERT INTO ctest VALUES ('password', '', '');

UPDATE ctest SET salt = gen_salt('md5');
UPDATE ctest SET res = crypt(data, salt);
SELECT res = crypt(data, res) AS "worked"
FROM ctest;

DROP TABLE ctest;