On Thu, 13 Apr 2000, hal at finney.org wrote:
> Bill writes:
<snip> 
> The handling of different-length strings is non-intuitive.  The same
> rule is applied except that characters beyond the end of the string
> get treated as 0.  So comparing "a" to "ab" or "ac", it is closer to
> "ab" because 0 is closer to 0x61 than to 0x62.  Comparing "a0" to "a"
> or "ab" it is closer to "a" because 0x30 is closer to 0 than to 0x61.
> However comparing "a1" to "a" or "ab" it is closer to "ab" because 0x31
> is closer to 0x61 than to 0.

The important thing about comparing strings of different lengths is the
difference in length should have as low signifigance as possible. The reason
for this is so that key types of different lengths (say one using a hash
algorith that gets a 256 bit value and another that gets 180 bits) should not
cluster to different nodes. Other then that it doesn't really matter, the
non-intuitivity of the current method stems mostly from the non-intuitive
layout of ASCII...  

> Hal
> 
> _______________________________________________
> Freenet-dev mailing list
> Freenet-dev at lists.sourceforge.net
> http://lists.sourceforge.net/mailman/listinfo/freenet-dev
-- 

Oskar Sandberg

md98-osa at nada.kth.se

#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev

Reply via email to