qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aidan Skinner" <ai...@apache.org>
Subject Re: Random .Net question
Date Thu, 05 Jun 2008 10:12:03 GMT
On Thu, Jun 5, 2008 at 10:19 AM, Aidan Skinner <aidan@apache.org> wrote:

> On Thu, Jun 5, 2008 at 1:01 AM, Tomas Restrepo
> <tomas.restrepo@devdeo.com> wrote:
>
>> As far as I remember, the .NET client already uses UTF-8:
>>
>>         byte[] secret = Encoding.UTF8.GetBytes(passwd);
>>
>> But maybe I'm just missing something. I definitely haven't done as
>> many tests as Aidan :)
>
> It does, this is a new CRAM-MD5-HASHED implementation, the regular
> CRAM-MD5 wouldn't exhibit this with most 'normal'[1] passwords.

I am clearly losing it, but this program:

using System;
using System.Globalization;

namespace Byter
{
    class Program
    {
        static void Main(string[] args)
        {

            byte[] hexkey = new byte[]{0x08, 0x4e, 0x03, 0x43,
		                           0xa0, 0x48, 0x6f, 0xf0,
                                   0x55, 0x30, 0xdf, 0x6c,
                                   0x70, 0x5c, 0x8b, 0xb4};

        	byte[] key =
System.Text.UTF8Encoding.UTF8.GetBytes(System.Text.UTF8Encoding.UTF8.GetString(hexkey));
        	int i = 0;
        	foreach (byte b in key)
        	{
        		Console.Write("0x"+b.ToString("x2",
CultureInfo.InvariantCulture)+",");
            	if (++i % 4 == 0) {
                	Console.WriteLine();
            	}
        	}
        }
    }
}

Produces
0x08,0x4e,0x03,0x43,
0x48,0x6f,0x55,0x30,
0x6c,0x70,0x5c,

Which is different from the java equivalent posted previously. I'm
making a note here, HUGE SUCESS.

- Aidan
-- 
aim/y!:aidans42 g:aidan.skinner@gmail.com
http://aidan.skinner.me.uk/
"We belong to nobody and nobody belongs to us. We don't even belong to
each other."

Mime
View raw message