mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
27 lines
630 B
Plaintext
27 lines
630 B
Plaintext
|
--
|
||
|
-- crypt() and gen_salt(): md5
|
||
|
--
|
||
|
select crypt('', '$1$Szzz0yzz');
|
||
|
crypt
|
||
|
------------------------------------
|
||
|
$1$Szzz0yzz$To38XrR3BsbXQW2ZpfKjF1
|
||
|
(1 row)
|
||
|
|
||
|
select crypt('foox', '$1$Szzz0yzz');
|
||
|
crypt
|
||
|
------------------------------------
|
||
|
$1$Szzz0yzz$IYL49cd3t9bllsA7Jmz1M1
|
||
|
(1 row)
|
||
|
|
||
|
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;
|
||
|
worked
|
||
|
--------
|
||
|
t
|
||
|
(1 row)
|
||
|
|
||
|
drop table ctest;
|