Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MD5 HASH computed from DBMS_CRYPTO does not match .NET MD5

Satish KandiMar 15 2012 — edited Nov 21 2012
Oracle 10.2.0.5.0
Windows 2003 R2 Standard Edition 32 bit

Note: This probably is a question for Microsoft forums but I just wanted to seek inputs from this forum first.

Used following piece of code
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SET SERVEROUT ON
SQL>
SQL> DECLARE
  2     sRAWString   RAW (32767) := UTL_RAW.CAST_TO_RAW ('1234567890');
  3  BEGIN
  4     DBMS_OUTPUT.put_line (SYS.DBMS_CRYPTO.HASH (sRAWString, SYS.DBMS_CRYPTO.HASH_MD5));
  5  END;
  6  /
E807F1FCF82D132F9BB018CA6738A19F

PL/SQL procedure successfully completed.
Wrote similar piece of code from .NET and the output does not match.
byte[] data = Encoding.ASCII.GetBytes("1234567890");

HashAlgorithm hA = MD5.Create() as HashAlgorithm;

data = hA.ComputeHash(data);

string ABC = Encoding.ASCII.GetString(data);
The byte array before the ComputeHash call is "23272412522484519471551762420210356161159".

Also the output that we receive from .NET cannot be displayed in our current Windows code page/font (square boxes and inverted question marks.

Could you please share any inputs in this regard?
This post has been answered by unknown-7404 on Mar 15 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2012
Added on Mar 15 2012
4 comments
2,860 views