Re: C# MD5 vs MD5sum

From: chis2k (sfd_at_sdf.com)
Date: 07/25/03


Date: Fri, 25 Jul 2003 12:44:15 -0700


Already Answered!

You're assuming that the result of MD5sum is the Base64 result - it
looks more like hex to me. Indeed, if you try the following program
which converts your base64 to hex, you'll see a familiar sequence...

using System;

public class Test
{
    static void Main()
    {
        byte[] md5 = Convert.FromBase64String
                        ("w3onGb2DunZrKdj4PO5iWA==");
        Console.WriteLine (BitConverter.ToString(md5));
    }
}

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
"chis2k" <sfd@sdf.com> wrote in message
news:uQrlt$tUDHA.1152@tk2msftngp13.phx.gbl...
> I am trying to figure out how to get the MD5 sum of a file that is like
the
> result from the MD5sum.exe program that is readily available on the
> internet. I tried the following but it gives me something completely
> different.... Any ideas?
>
> MD5sum.exe output = c37a2719bd83ba766b29d8f83cee6258
> My program output = w3onGb2DunZrKdj4PO5iWA==
>
> public string GetMD5Hash( byte[] input_buffer) {
>     // create implementation of MD5
>     MD5 md5 = new MD5CryptoServiceProvider();
>     // get hash
>     return System.Convert.ToBase64String(md5.ComputeHash(input_buffer));
> }
>
>


Relevant Pages

  • Re: Cohens paper on byte order
    ... > A mapping is involved, and it plays a role in the ... has hex digits, but actually in the memory there ... mean in another notation ... 'transferring' a bit sequence of 128 bit of the key ...
    (sci.crypt)
  • Re: Cohens paper on byte order
    ... > 'perfect bit sequence FIPS'. ... the other interpretation, ... > sequence but as a sequence of pairs of hex digits clearly implies that it is ...
    (sci.crypt)
  • Re: Cohens paper on byte order
    ... > conventions used in the FIPS, ... > If the input is truly an indexed bit sequence, ... >> notation, obtaining a sequence of hex digits, again ...
    (sci.crypt)
  • Re: 9V 1A schematic needed
    ... Math Processor is simply a support for the understanding of the sequence, ... Look at the hex sequence, ... youth has termed the Spit as "output" from the source. ...
    (sci.electronics.design)
  • Re: Cohens paper on byte order
    ... > sequence, in this case; ... > octet should receive the lower bit index. ... > that all platforms shall swap the bits (in terms of ... The hex notation is 'equivalent' to the bit serial ...
    (sci.crypt)