How reimplement BCryptPasswordHasher of django with postgres 9.1
问题 I have a postgres 9.1 database that is used by both a django website and a application server. Currently, I use the old SHA1 authentication in both system, but will upgrade to bcrypt. I have this: CREATE OR REPLACE FUNCTION random_string(length INTEGER, OUT RETURNS TEXT) AS $$ BEGIN IF length < 0 THEN raise exception 'Given length cannot be less than 0'; END IF; RETURNS = libs.gen_salt('bf', length); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION encryp_TEXT(_TEXT TEXT, OUT RETURNS TEXT