I. Technical Points
1. dbms_obfuscation_toolkit.md5
Dbms_obfuscation_toolkit.md5 is an MD5-encoded data packet function, but an error message is displayed when select dbms_obfuscation_toolkit.md5 (input_string => 'abc') A from dual, it seems that this function can only be called directly in the package and cannot be directly applied to select statements.
2. utl_raw.cast_to_raw
The string returned by dbms_obfuscation_toolkit.md5 is of the raw type. to display the string correctly, it must undergo utl_raw.cast_to_raw conversion.
II. Application
1. Direct call
Declare
V2 varchar2 (32 );
Begin
V2: = utl_raw.cast_to_raw (SYS. dbms_obfuscation_toolkit.md5 (input_string => '2016 '));
Dbms_output.put_line (V2 );
End;
Note: It can be called directly in the stored procedure. If you want to nest the MD5 call, remember to use utl_raw.cast_to_raw for conversion after each call. Otherwise, the final result is incorrect.
2. Call the constructor
Create or replace function MD5 (
Passwd in varchar2)
Return varchar2
Is
Retval varchar2 (32 );
Begin
Retval: = utl_raw.cast_to_raw (dbms_obfuscation_toolkit.md5 (input_string => passwd ));
Return retval;
End;
Example of calling the MD5 function:
Select MD5 (1) from dual