Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,665 of 4,675    |
|    wolfgang kern to All    |
|    Re: DJB2    |
|    11 Nov 18 13:39:47    |
      From: nowhere@never.at              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 ?              > lodsb ; gnc       > cmp al,0x20 ; End Word       > jbe EndCalc       > loop CalcNext       > NextBlock:       > jmp ReadBlock       > EndCalc:       > xchg ax,dx ; result into ax       >       > ;; [prt ax as hex to Obuffer]       >       > jmp NextWord              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.       And hash-encrypted stuff seems easy to hack anyway.       __       wolfgang              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca