Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

hash_password : what is the replace of 'DBMS_OBFUSCATION_TOOLKIT.MD5'

SmithJohn45Oct 14 2022

it is mainly related to Oracle SQL and PL/SQL not only Apex.
i am following a post for custom authentication where a function as below in DB version 21c XE is not compiling and showing error: ( working fine in 11g XE )
PLS-00201: identifier 'DBMS_OBFUSCATION_TOOLKIT.MD5' must be declaredCompilation failed,line 179 (09:58:17)

function hash_password 
 (p_user_name in varchar2,
  p_password in varchar2)
return varchar2
is
 l_password varchar2(255);
 -- The following salt is an example. 
 -- Should probably be changed to another random string.
 l_salt varchar2(255) := '2345USFGOJN2T3HW89EFGOBN23R5SDFGAKL';
begin
  --
  -- The following encryptes the password using a salt string and the 
  -- DBMS_OBFUSCATION_TOOLKIT. 
  -- This is a one-way encryption using MD5
  -- 
  l_password := utl_raw.cast_to_raw (
					dbms_obfuscation_toolkit.md5(
					input_string => p_password ||
                                         substr(l_salt,4,14) ||
                                         p_user_name ||
                                         substr(l_salt,5,10))
                                   );
  return l_password;
end hash_password;
/

link to that guide is not working now at least for me.
https://blogs.oracle.com/apex/post/custom-authentication-and-authorization-using-built-in-apex-access-control-a-how-to so, what is the replacement of that to have a working hash_password function which i want to use in my custom authentication seheme. kindly help with example if possible.
regards

Comments
Post Details
Added on Oct 14 2022
2 comments
1,533 views