PolarDB for PostgreSQL(Compatible with Oracle) is compatible with Oracle databases and provides the MD5 functions and stored procedures of the DBMS_OBFUSCATION_TOOLKIT package.

Precautions

When you create a database for a PolarDB for PostgreSQL(Compatible with Oracle) cluster created on or after March 30, 2020, the DBMS_OBFUSCATION_TOOLKIT plug-in is automatically created.

When you create a database for a PolarDB for PostgreSQL(Compatible with Oracle) cluster created before March 30, 2020, the DBMS_OBFUSCATION_TOOLKIT plug-in is not automatically created. To use the plug-in, you must execute the following statement to manually create the plug-in after you create the database:
CREATE EXTENSION polar_dbms_obfuscation_toolkit;

For more information about the plug-in, see DBMS_OBFUSCATION_TOOLKIT.

DBMS_OBFUSCATION_TOOLKIT functions and stored procedures

Function or stored procedureTypeInput parameter typeOutput parameter type
dbms_obfuscation_toolkit.md5FunctionBYTEARAW_CHECKSUM
dbms_obfuscation_toolkit.md5Stored procedureBYTEARAW_CHECKSUM
dbms_obfuscation_toolkit.md5FunctionCHARACTER VARYINGCHARACTER VARYING
dbms_obfuscation_toolkit.md5Stored procedureCHARACTER VARYINGCHARACTER VARYING

Usage

  • Execute the MD5 functions.
    select dbms_obfuscation_toolkit.md5('a'::varchar2);
    select dbms_obfuscation_toolkit.md5('a'::raw);
  • Execute the MD5 stored procedures.
    declare
      input varchar2(100):= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
      checksum1 raw(100);
      checksum2 varchar2(100);
    begin
      dbms_obfuscation_toolkit.md5(input=>utl_raw.cast_to_raw(input), checksum=>checksum1);
      dbms_obfuscation_toolkit.md5(input_string=>input, checksum_string=>checksum2);
      dbms_output.put_line(checksum1);
      dbms_output.put_line(utl_raw.cast_to_raw(checksum2));
    end;