Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!necntc!dandelion!ulowell!page From: page@swan.ulowell.edu (Bob Page) Newsgroups: comp.sys.amiga Subject: Re: The AmigaDos Hash function, how??? Message-ID: <2448@swan.ulowell.edu> Date: 19 Jan 88 20:53:16 GMT References: <8801182112.AA24295@jade.berkeley.edu> Reply-To: page@swan.ulowell.edu (Bob Page) Organization: University of Lowell, Computer Science Dept. Lines: 74 [ another topic for comp.sys.amiga.tech :-) ] RCST12@HEITHE5.BITNET wrote: >After some time trying to reverse-engineer it out of disked and a Yeah, DiskEd. The program that can work on floppies, and the disk doesn't have to be inserted to be examined by DiskEd. Now that's what I call true Guru Meditation. ;-) >How does the hashfunction work?? From: amiga!neil (Neil Katin) Subject: Dos hash function Date: 12 Apr 86 08:56:54 GMT Recently several people have asked for the dos directory hash function. Here is a small program that computes it. The hash value is the longword offset into the directory block, NOT into the hash table (I just love that BCPL...). Anyway, hope it helps. Neil Katin Commodore-Amiga Inc. pyramid!amiga!neil ---- cut here -------------------- main( argc, argv ) int argc; char **argv; { if( argc != 2 ) { printf( "Usage: %s \n", argv[0] ); exit( 1 ); } printf( "hash is %ld\n", (hash( argv[1] ) % 72) + 6 ); } hash( s ) unsigned char *s; { int i; int res; unsigned char *sp; unsigned c; res = strlen( s ); for( i = 1, sp = s; *sp; i++, sp++ ) { c = *sp; if( c >= 'a' && c <= 'z' ) { c = c - 'a' + 'A'; } res = ((res * 13 + c ) & 0x7ff); } return( res ); } >searn trough the RKM's and the amigados manual we're kind of desperate. >Any Help is Welcome! >Please reply with mail since the news-feed is very irregular lately. >Thanks, > >Martien Kuunders, >RCST12 @ HEITHE5.BITNET or >rcst12@eutrc3.uucp (try routing it via mcvax) > >"You name it, I'll disclaim it." -- Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page "I don't know such stuff. I just do eyes." -- from 'Blade Runner'