[Microid] Encode URLs?

David Koblas koblas at extra.com
Mon Apr 16 19:58:42 EDT 2007


If I'm reading this thread correctly it sounds like people are proposing 
to double encode URIs before having their checksums  taken.

Section 5 of the spec says:
    hash = algo(algo(EntityURI) + algo(EntityURI))

It doesn't say:
    hash = algo(algo(escaped(URI)) + ...)

If the PHP code converted to (technically something worse than)
    com_sha = hex_sha1(urlencode(f.com.value));
Things would get quite messy.  Since you now end up with multiple 
encoding systems, etc.

Fundamentally, the URL:   
    http://www.mediauk.com/discussions/profile.muk?mode=viewprofile&u=1   
is encoded per RFC 3986 - section 3 -   
    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
as soon as you start double encoding a URL you're in deep doodoo.

--koblas

ps.  Per your problem I get using my MicroID implementation..
    mailto+http:sha1:05d7b7fe2c3a67fab3982b50c9a727c04c9aab9c

What I belive is your problem is "+" vs. "."  MicroIDs are an APPEND 
operation not a NUMERIC operation.

Paco NATHAN wrote:
> That  brings up a good point.  Is there a list of known "edge cases"
> which we could use for creating unit tests?  Examples like this one
> could be used to begin to build a list.
>
> I could add that kind of unit testing to the Java library.
>
> Thanks,
> Paco
>
>
> On 4/16/07, Peter Saint-Andre <stpeter at jabber.org> wrote:
>   
>>> AFAICS, URIs within MicroID need to conform to RFC 3986. Therefore
>>> percent-encoding (%hexhex) would be required for certain characters. For
>>> your web page address ...
>>>
>>> http://www.mediauk.com/discussions/profile.muk?mode=viewprofile&u=1
>>>       
>> The JavaScript code on microid.org does not perform any encoding:
>>
>> function compute()
>> {
>>      var f = document.forms['gen'];
>>      var com_sha = hex_sha1(f.com.value);
>>      var auth_sha = hex_sha1(f.auth.value);
>>      f.microid.value = "mailto+http:sha1:" + hex_sha1(com_sha+auth_sha);
>> }
>>
>> So I think the error is there.
>>
>> Feel free to contribute corrected code. :)
>>     
> _______________________________________________
> Microid mailing list
> Microid at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/microid
>
>   


More information about the Microid mailing list