I've been using this function to hash passwords for years without issue. On a new client, the hash suddenly changes about a week later. This causes the comparison with the stored password hash to fail when trying to authenticate users. Anyone have any ideas of what might be happening?
This is on a newly installed Database XE 21.
create or replace FUNCTION "HASH_PASSWORD" (p_user_name in varchar2, p_password in varchar2) return varchar2 is
l_password varchar2(255);
l_salt varchar2(255) := '9XfDo10Tn2grxTz5Z5ZbIdaQfZm3SlEtDU4KQSQZ5h53HvpXEW';
begin
l_password := utl_raw.cast_to_raw(dbms_crypto.hash(UTL_I18N.STRING_TO_RAW (p_password||substr(l_salt,4,14)||p_user_name||substr(l_salt, 5, 10), 'AL32UTF8'), dbms_crypto.HASH_MD5));
return l_password;
end;
/