Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> compute md5-hash from file

compute md5-hash from file

From: Thomas Peter <braindumped_at_expires-31-03-2007.news-group.org>
Date: Mon, 19 Mar 2007 14:20:14 +0100
Message-ID: <1174310414.92@user.newsoffice.de>


hi,
i try to compute a md5 checksum of a file with a pl/sql procedure. and i'm a pl/sql noob...

when i use UTL_FILE.FOPEN to open the file and UTL_FILE.GET_RAW for reading,
i get the md5-hash via dbms_obfuscation_toolkit.MD5 and passing the value from GET_RAW
but i experience a limit at 32767byte, which is the max buffersize of utl_file (right?)

reading the content line-by-line is not appropiate for computing a chechsum of the whole file

so i opended the file as blob:

b_file                BFILE;
b_file_length BINARY_INTEGER;
dst_blob             BLOB;

DBMS_LOB.CREATETEMPORARY(dst_blob,true); b_file := BFILENAME('DIR','test_utl_file.txt'); DBMS_LOB.OPEN(b_file,DBMS_LOB.LOB_READONLY); b_file_length := dbms_lob.getlength(b_file); Dbms_Lob.loadfromfile(dst_blob, b_file, b_file_length); checksum := dbms_obfuscation_toolkit.MD5(input => dst_blob); dbms_lob.fileclose(b_file);

but i get an ORA-06502 at the line of calling dbms_obfuscation_toolkit.MD5

any hint what i do wrong?

thnx in advance
thomas Received on Mon Mar 19 2007 - 08:20:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US