mangling scheme

Lucas Correia Villa Real lucasvr at
Mon Sep 9 08:17:01 GMT 2002

On 09 Sep 2002 09:27:21 +0200
Simo Sorce <simo.sorce at> wrote:

> On Mon, 2002-09-09 at 08:33, Lucas Correia Villa Real wrote:
> > Hi,
> > 
> > Recently I did find a little trouble in a program: it creates links
> > to the most recently used files, but using the not-so-'default' Win9X
> > mangling scheme, that is, 'program files' becomes 'progra~1' and not
> > 'progr~-1'.
> This seem to me the correct behaviour, why do you think it should be
> progr~1 ?

Sorry, I think I was misunderstood here. What the program do is to 
address 'program files' into 'progra~1', the same way as the WinNT 
server was doing, but with Samba the same entry become 'progr~-1',
using the hash1 algorithm.

> > I did a search over the samba archives and noticed some patches and 
> > discussions about performance and even about non-compliance between 
> > Win9x and WinNT mangling methods. Is there a working* patch to do 
> > that kind of stuff? If not, can someone point me to the algorithms
> > used by Win9X/NT to do that? Will such a patch be welcome by Samba?
> I extendedly tested the w2k alghorithms, that I suppose are the same as
> NT, and they seem to use the 6chars+~1 through ~5 and then they start to
> produce a poor hash based name like prA9BF~1 that is clearly a 2 bytes
> lenght hex representation. The exact alghorithm is not known to me, but
> we tested that it is really poor and prone to lot of name collisions.
> We implemented a new mangling alghorithm for HEAD called hash2 that is
> pretty good. Look at smbd/mangle_hash2.c if you are curious.
> About patches they are always welcome, but to be accepted they need to
> address a real problem and get it the right way, what do you have in
> mind exactly?

I just got the sources, and as far as I could see, that's exactly what I 
was looking for. I will put it in action today.

> I have some code for a tdb based persistent mangling db that could help
> but it is not ready yet and broken in little pieces part of new code and
> part of code from an older not very good implementation.

Thanks for your attention, if I feel I will need to use a different scheme
I will try to give a look at it.


More information about the samba-technical mailing list