mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
27 lines
492 B
Plaintext
27 lines
492 B
Plaintext
|
--
|
||
|
-- crypt() and gen_salt(): crypt-des
|
||
|
--
|
||
|
select crypt('', 'NB');
|
||
|
crypt
|
||
|
---------------
|
||
|
NBPx/38Y48kHg
|
||
|
(1 row)
|
||
|
|
||
|
select crypt('foox', 'NB');
|
||
|
crypt
|
||
|
---------------
|
||
|
NB53EGGqrrb5E
|
||
|
(1 row)
|
||
|
|
||
|
create table ctest (data text, res text, salt text);
|
||
|
insert into ctest values ('password', '', '');
|
||
|
update ctest set salt = gen_salt('des');
|
||
|
update ctest set res = crypt(data, salt);
|
||
|
select res = crypt(data, res) as "worked" from ctest;
|
||
|
worked
|
||
|
--------
|
||
|
t
|
||
|
(1 row)
|
||
|
|
||
|
drop table ctest;
|