6 <indexterm zone=
"chkpass">
7 <primary>chkpass
</primary>
11 This module implements a data type
<type>chkpass<
/> that is
12 designed for storing encrypted passwords.
13 Each password is automatically converted to encrypted form upon entry,
14 and is always stored encrypted. To compare, simply compare against a clear
15 text password and the comparison function will encrypt it before comparing.
19 There are provisions in the code to report an error if the password is
20 determined to be easily crackable. However, this is currently just
21 a stub that does nothing.
25 If you precede an input string with a colon, it is assumed to be an
26 already-encrypted password, and is stored without further encryption.
27 This allows entry of previously-encrypted passwords.
31 On output, a colon is prepended. This makes it possible to dump and reload
32 passwords without re-encrypting them. If you want the encrypted password
33 without the colon then use the
<function>raw()<
/> function.
34 This allows you to use the
35 type with things like Apache's Auth_PostgreSQL module.
39 The encryption uses the standard Unix function
<function>crypt()<
/>,
41 from all the usual limitations of that function; notably that only the
42 first eight characters of a password are considered.
46 Note that the chkpass data type is not indexable.
48 I haven't worried about making this type indexable. I doubt that anyone
49 would ever need to sort a file in order of encrypted password.
58 test=# create table test (p chkpass);
60 test=# insert into test values ('hello');
62 test=# select * from test;
68 test=# select raw(p) from test;
74 test=# select p = 'hello' from test;
80 test=# select p = 'goodbye' from test;
91 D'Arcy J.M. Cain (
<email>darcy@druid.net
</email>)