----------------------------------------------------
-- Export file for user daimami.com --
-- Created by Administrator on 2010-6-2, 16:33:33 --
----------------------------------------------------
spool md5_fun.log
prompt
prompt Creating function MYMD5
prompt =======================
prompt
create or replace function mymd5(input_string VARCHAR2) return varchar2 IS
raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(input_string);
decrypted_raw RAW(2048);
error_in_input_buffer_length EXCEPTION;
BEGIN
--dbms_output.put_line(sysdate || '> 加密前的数据:' || input_string);
sys.dbms_obfuscation_toolkit.MD5(input => raw_input,
checksum => decrypted_raw);
--dbms_output.put_line(sysdate || '> 加密后的数据:' || rawtohex(decrypted_raw));
return lower(rawtohex(decrypted_raw));
END;
/
spool off