René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

dbms_crypto

dbms_crypto (available with 10g) has a better random generator than dbms_random. The following three functions can be used

Procedures/Functions

decrypt

function decrypt returns raw (
 src                                in                      raw        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);
procedure decrypt (
 dst                            in out                     blob        ,
 src                                in                     blob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);
procedure decrypt (
 dst                            in out                     clob        ,
 src                                in                     blob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);

encrypt

function encrypt returns raw (
 src                                in                      raw        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);
procedure encrypt (
 dst                            in out                     blob        ,
 src                                in                     blob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);
procedure encrypt (
 dst                            in out                     blob        ,
 src                                in                     clob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        ,
 iv                                 in                      raw default
);

hash

function hash returns raw (
 src                                in                      raw        ,
 typ                                in           binary_integer        
);
function hash returns raw (
 src                                in                     blob        ,
 typ                                in           binary_integer        
);
function hash returns raw (
 src                                in                     clob        ,
 typ                                in           binary_integer        
);

mac

function mac returns raw (
 src                                in                      raw        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        
);
function mac returns raw (
 src                                in                     blob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        
);
function mac returns raw (
 src                                in                     clob        ,
 typ                                in           binary_integer        ,
 key                                in                      raw        
);

randombytes

function randombytes returns raw (
 number_bytes                       in           binary_integer        
);
Oracle's documentation states that sqlnet.crypto_seed must be set in the sqlnet.ora file; however, this option seems to be removed as can be seen in the samples subdirectory of $ORACLE_HOME/NETWORK/ADMIN
Thanks to Frank van Bortel to bring that to my attention.

randominteger

function randominteger returns binary_integer (
);

randomnumber

function randomnumber returns number (
);