"MartyNg" <MartyNg@gmail.com> wrote in news:1144414133.827483.310840
@v46g2000cwv.googlegroups.com:
[color=blue]
> We cannot seem to get the hashes to match up between platforms, even
> after taking other forum posts into consideration, such as making sure
> we are using UTF-8 encoding and such.[/color]
Good shankers, an MD5 digest of the same data should be *exactly* the same
regardless of what application or platform it was generated with. That's
why it's called an algorithm.
You need to figure out which of the two calculations is wrong (or maybe
both of them are!), and FIX them, not come up with a hack to go get the
hash from the source you *think* is right!
Verify the output of your code against an implementation you know is
right, like the md5sum utility that comes with Linsux or the BSDs. There
are lots of other tested/verified implementations out there.
The other problem you might be running into is the way you 'prepare' the
bytes (bad analogy) to feed them to the hash generator. Python for example
will generate different hashes for the same data read from a file if you
make the mistake of not opening the file in 'binary' mode.
In .NET this is not a problem as long as you use a *binary* reader, like
System.IO.FileStream. You mentioned UTF-8... that's besides the point. The
MD5 algo works on *bytes*, so string encoding is irrelevant in that
context.
--
Klaus H. Probst, MVP
http://www.simulplex.net/