Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: converting dbms_obfuscation_toolkit.md5 result to "conventional" md5 result
MD5 is overloaded there and returns either 16-byte RAW or typecasted
16-byte varchar2 depending on type of input (raw for raw, varchar2 for
varchar2). You need to use rawtohex() to receive hexadecimal
representation of the raw value. Call it this way, for example:
SQL> var hash varchar2(32)
SQL> exec :hash := rawtohex(utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5(input_string =>
'data')))
PL/SQL procedure successfully completed.
SQL> print hash
HASH
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer. "Theodore Hope" <theodorehope_at_yahoo.com> wrote in message news:58a786eb.0206192040.5dfeae4e_at_posting.google.com...Received on Thu Jun 20 2002 - 06:34:28 CDT
> The dbms_obfuscation_toolkit.md5 function returns a 16-character
> string of hex characters, and I presume that each hex character
> represents one of the bytes of the 128-bit hash result (16*8 = 128).
>
> However, in all other contexts in which I've used md5 (unix
> command-line, PHP, perl, etc.), the "conventional" md5 result is a
> 32-character string of hex characters in which each pair of hex
> characters represents one of the bytes of the 128-bit hash result
> (32/2*8 = 128).
>
> Can anyone suggest a quick way of converting between the 32-character
> "conventional" string of hex chars and the 16-char string that
> dbms_obfuscation_toolkit.md5 likes to return?
>
> Thanks!