To enable cryptographic functions in PostgreSQL you have to install the pgcrypto module. For Ubuntu it is included in the postgresql-contrib-8.3 package.
After installing the package you need to enable each database that needs cryptography by running the pgcrypto.sql script.
Here is an example for encrypting passwords using SHA1, converted to hexadecimal:
SELECT ENCODE(DIGEST(password, 'sha1'), 'hex') FROM user
For more information on available crypto methods see: http://www.postgresql.org/docs/8.3/interactive/pgcrypto.html