Path: utzoo!utgpu!water!watmath!clyde!rutgers!cbmvax!carolyn From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Newsgroups: comp.sys.amiga Subject: Re: The AmigaDos Hash function, how??? Message-ID: <3163@cbmvax.UUCP> Date: 19 Jan 88 14:27:36 GMT References: <8801182112.AA24295@jade.berkeley.edu> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 43 In article <8801182112.AA24295@jade.berkeley.edu> RCST12@HEITHE5.BITNET writes: >Subject: AmigaDos hash function, how??? > > >A friend of mine is writing a disk-editor, and he ran into a problem >when he wanted to put some amigados knowledge into it. >The question is : How does the hashfunction work?? HASH FUNCTION The hash function is applied to the name of a file or directory, and the resulting value provides an offset into the HashTable which contains either zero or a key to the first block on a chain linking blocks with the same hash value. Each block contains a name field which identifies it. The directory and file header block fields are described in the AmigaDOS manual. int HashName(str,hlen) char *str; /* The string to find the hash number for */ int hlen; /* The length of the hash table */ { char xchar; int i, result; result = strlen(str); for (i=0; i>Commodore Amiga Technical Support<< UUCP ...{allegra,ihnp4,rutgers}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=