/****************************************************************************/
/* SYSTEM_ID : GF                                                           */
/* CUSTOM_HASH ( FUNCTION )                                                 */
/* Created : 2014/12/13 13:30:50                                            */
/****************************************************************************/
CREATE FUNCTION CUSTOM_HASH 
function custom_hash (p_username in varchar2, p_password in varchar2)
return varchar2
is
  l_password varchar2(4000);
  l_salt varchar2(4000) := '7KX9QXGG4U4E0IYTL4D0GIIHXC4YOL';
begin

-- This function should be wrapped, as the hash algorhythm is exposed here.
-- You can change the value of l_salt or the method of which to call the
-- DBMS_OBFUSCATOIN toolkit, but you much reset all of your passwords
-- if you choose to do this.

l_password := utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5
  (input_string => p_password || substr(l_salt,10,13) || p_username ||
    substr(l_salt, 4,10)));
return l_password;
end;
/
