final fixes for & hash val()

This commit is contained in:
Kelvin Sherlock 2017-04-09 10:39:47 -04:00
parent 2076d76d14
commit da73d4139e
1 changed files with 7 additions and 5 deletions

View File

@ -302,7 +302,7 @@ hash_val
; str2 = plaintext ; str2 = plaintext
; returns 1 if & hash(type, salt+plaintext)=hash ; returns 1 if & hash(type, salt+plaintext)=hash
bsr break ;bsr break
; a1 used for return value (OMM_PUTWORD) ; a1 used for return value (OMM_PUTWORD)
stz a1 stz a1
@ -499,10 +499,11 @@ salt
sty prmtbl+2 ; count sty prmtbl+2 ; count
iny iny
dex dex
; bmi @bad would allow 0-length hash.
beq @bad beq @bad
phx
phy phy
phx
; hash append the salt. ; hash append the salt.
lda #MSG_USER lda #MSG_USER
@ -537,7 +538,7 @@ str equ lowtr+1
bit a2 ; hash length bit a2 ; hash length
bmi exit bmi exit
lda #str lda str
sta prmtbl sta prmtbl
stx prmtbl+2 stx prmtbl+2
; hash it ; hash it
@ -560,18 +561,19 @@ str equ lowtr+1
dc.b $42, WDM_ID dc.b $42, WDM_ID
lda prmtbl+2 ; actual size lda prmtbl+2 ; actual size
bne exit beq exit
cmp a2 cmp a2
bne exit bne exit
lsr a ; / 2
tay tay
dey dey
dey
@loop @loop
lda (prmtbl),y lda (prmtbl),y
cmp (prmtbl+4),y cmp (prmtbl+4),y
bne exit bne exit
dey dey
dey
bpl @loop bpl @loop
lda #1 lda #1
sta a1 sta a1