flat assembler
Message board for the users of flat assembler.

Index > Main > testing Hash algorithms

Author
Thread Post new topic Reply to topic
r22



Joined: 27 Dec 2004
Posts: 805
r22
Anyone know of a good program and/or insane mathematical formula for testing collisions in hash algorithms?

Code:
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?
Post 01 May 2005, 06:28
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Afaik, there;s no specific method for finding collisions. It's mathematicians who find (sometimes searching even a few years) them. For example, collision in SHA-160 algorithm was found not long ago, but an algorithm itself is quite old.
Post 01 May 2005, 11:06
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Hmm was it 256bit in length? It takes days to find solutions even on faster machines.

If your hash would be 16 or 32bit one it should be a matter of seconds, but I think you can be really sure that the collisions are very rare for 256bit ones.
Post 07 May 2005, 10:54
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.