contrib/pgcrypto/sql/crypt-md5.sql
raw| 1 | -- |
| 2 | -- crypt() and gen_salt(): md5 |
| 3 | -- |
| 4 | |
| 5 | SELECT crypt('', '$1$Szzz0yzz'); |
| 6 | |
| 7 | SELECT crypt('foox', '$1$Szzz0yzz'); |
| 8 | |
| 9 | CREATE TABLE ctest (data text, res text, salt text); |
| 10 | INSERT INTO ctest VALUES ('password', '', ''); |
| 11 | |
| 12 | UPDATE ctest SET salt = gen_salt('md5'); |
| 13 | UPDATE ctest SET res = crypt(data, salt); |
| 14 | SELECT res = crypt(data, res) AS "worked" |
| 15 | FROM ctest; |
| 16 | |
| 17 | DROP TABLE ctest; |