How to generate md5 value in Oracle

SQL:

SELECT DBMS_OBFUSCATION_TOOLKIT.md5(input => UTL_I18N.STRING_TO_RAW ('pass123'||'46728595335', 'AL32UTF8')) Alias from dual;

Alias

C0FD11DBF7C9FF16AD9CE40E303135B3

 Function:

CREATE OR REPLACE FUNCTION Hash_MD5 (p_msisdn IN VARCHAR2) RETURN VARCHAR2 IS
      v_secret VARCHAR2(32) := '
pass123';
   BEGIN
      RETURN (DBMS_CRYPTO.HASH (UTL_I18N.STRING_TO_RAW (v_secret||p_msisdn, 'AL32UTF8'), DBMS_CRYPTO.HASH_MD5));
   END Hash_MD5;

 

select Hash_MD5('46728595335') from dual;

Alias

C0FD11DBF7C9FF16AD9CE40E303135B3

 

Comments