Anyone know of a good program and/or insane mathematical formula for testing collisions in hash algorithms?
hashInit dw 5381,6833,4649,7577,6199,5209,3739,6143 ;primes
HashBuffer:
.pointer equ EBP+8
.length equ EBP+12
.output equ EBP+16
push ebp
mov ebp,esp
mov edx,[.pointer] ;str/data buffer pointer
lea ecx,[.length] ;length of buffer
shr ecx,4 ;str ptr memory will always have
add ecx,1 ;at least 16 nulls after the
shl ecx,4 ;last char so make len multiple of 16
mov eax,hashInit
movq mm0,[eax]
movq mm1,[eax+8]
movq mm4,[edx]
movq mm5,[edx+8]
.hash:
cmp ecx,0
je .done
movq mm2,mm0
movq mm3,mm1
pslld mm2,5
pslld mm3,5
paddq mm0,mm3
paddq mm1,mm2
paddq mm0,mm4
paddq mm1,mm5
add edx,16
sub ecx,16
movq mm4,[edx]
movq mm5,[edx+8]
jmp .hash
.done:
mov eax,[.output]
movntq [eax],mm0
movntq [eax+8],mm1
mov esp,ebp
pop ebp
ret 12
It's a variation of the djb algorithm only expanded and optimized. Well it could be optimized further using XMMX instructions. BUT in any case anyone know of a way to test it for collisions?