Friday, August 16, 2013

Encrypt Data Using MD5 and SHA - Oracle Database

Following Oracle database packages enables you to encrypt critical data like passwords using SHA or MD5 encryption algorithms.

MD5: dbms_obfuscation_toolkit.md5
SHA: dbms_crypto.hmac_sh1

Sample usage:

MD5: 
utl_i18n.string_to_raw(dbms_obfuscation_toolkit.md5(input_string => <value to be encrypted>))

SHA:
encryption_key := dbms_random.string('X',16);
dbms_crypto.mac(utl_i18n.string_to_raw(<value to be encrypted>),
                           dbms_crypto.hmac_sh1,
                           utl_i18n.string_to_raw(encryption_key));

For more info, refer link.

No comments:

Post a Comment

Provide your thoughts !