Encrypt contraseña PostgreSQL

CREATE EXTENSION pgcrypto;

INSERT INTO users (email, password) VALUES (
  '[email protected]',
  crypt('johnspassword', gen_salt('bf'))
);

SELECT id 
  FROM users
 WHERE email = '[email protected]' 
   AND password = crypt('johnspassword', password);
JoeCoder