From: notsaying@nospicedham.invalid.org   
      
   On Sun, 11 Nov 2018 12:39:47 GMT, "wolfgang kern" wrote:   
      
   > Kerr-Mudd,John posted:   
   > ...   
   >> ReadBlock:   
   >> ;...   
   >> ; if no input exitprog   
   >> ; mov si,IBuffer   
   >> ; mov cx,IBuffLth   
   >>   
   >> CalcHash: ; si->word cx=lth| ax=hash , uses bl   
   >> mov bl,33   
   >> NextWord:   
   >> lodsb ; get 1st chr   
   >> dec cx   
   >> jcxz NextBlock   
   >> cmp al,0x20   
   >> jbe NextWord ; skip leading spaces   
   >> mov dx,5381 ; DJB2 hash; not hex num   
   >> CalcNext:   
   >> cbw ; ah=0 for next mul   
   >> xchg ax,dx   
   >> mul bl ; t*33   
   >> add dx,ax ; t*33+c   
   >   
   > I assume you wanted ax=ax*BL w/o altering DX   
   > after MUL: DH=0 DL=char AX=1505*21 == 2_b5a5 (top ignored)   
   > so DX become char + 'a constant' b5a5 after first iteration ?   
   >   
   > imul ax,ax,0x21 ;ax=ax*Sext imm8 (BX not used)   
   > add dx,ax   
   >   
      
   > so if   
   > 1st="A": DX= 0041 + b5a5 = .._b5e6   
   > 2nd="s" DX= 0073 + b5e6*21 = .._7319 (top ignored)   
   > 3rd="s" DX= 0073 + 7319*21 = .._d6ac   
   >   
      
   > is this what you expect it to do ?   
   >   
   Yes, thanks. Keyword noted!   
      
   >   
   > I could never see where there the gain of "hashing" actually is.   
   > Fast_Find can be achieved with SORT and/or INDEX-tables, shorten   
   > a list by compression (ie: to 6 bit ASCII) might help too.   
      
   It was to have a smaller text part, and avoid the chaining that FORTH uses   
   for it's keyword search. But Terje has shown that I was over-optimistic to   
   naively think I could have about half of 64k unique words. I suppose, if   
   I'm resigned to 32bits for a hash, I could instead use the MS shortfilename   
   approach of "SPAC" "SPA~1" etc as shortened versions of SPACE and SPACES,   
   but I'm going off the whole thing now.   
      
   > And hash-encrypted stuff seems easy to hack anyway.   
      
   Hiding source-code might have been a side effect, yes.   
   > __   
   > wolfgang   
   >   
   >   
      
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|