Differences between Oracle and tomcat md5 hash?
which version of Oracle are you running ? Your code gives the good answer on 10.2.0.3.0:
SQL> VARIABLE res VARCHAR2(32);SQL> Declare 2 v_checksum varchar2( 32 ); 3 v_hex_value varchar2( 32 ); 4 begin 5 v_checksum:=SYS.DBMS_OBFUSCATION_TOOLKIT.MD5(input_string=>'mypass'); 6 7 8 SELECT LOWER( RAWTOHEX( v_checksum ) ) 9 INTO v_hex_value 10 FROM dual; 11 12 :res := v_hex_value; 13 end; 14 /PL/SQL procedure successfully completedres---------a029d0df84eb5549c641e04a9ef389e5
Also I tried the other MD5
functions and they give the same answer:
SQL> DECLARE 2 l_input RAW(16) := utl_raw.cast_to_raw('mypass'); 3 BEGIN 4 :res:=lower(rawtohex(dbms_obfuscation_toolkit.md5(input=>l_input))); 5 END; 6 /PL/SQL procedure successfully completedres---------a029d0df84eb5549c641e04a9ef389e5
Your code seems correct
I also get a029d0df84eb5549c641e04a9ef389e5 here http://md5hashgenerator.com/index.php
and also in sql server I get the same
SELECT CONVERT(VARCHAR(32),HashBytes('MD5', 'mypass'),2)