## [DHA]: A new hashing algorithm

The fear of every surveillance society: citizens protecting their own privacy with strong cryptography

### [DHA]: A new hashing algorithm

Hello there fellows,
a few weeks ago I came up with my own hashing algorithm and I could use some feedback. It was made in 2 hours in Python.
It is available on GitHub.

There is a good explanation of how it works. If anyone can look at it and analyze it, it would be good.
Report all collisions and suggest corrections. Thanks.
payload
New User

Posts: 2
Joined: Tue Jan 01, 2013 3:10 pm
Blog: View Blog (0)

### Re: [DHA]: A new hashing algorithm

I'd suggest making this importable.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.

fashizzlepop
Developer

Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)

### Re: [DHA]: A new hashing algorithm

payload wrote:Hello there fellows,
a few weeks ago I came up with my own hashing algorithm and I could use some feedback. It was made in 2 hours in Python.
It is available on GitHub.

There is a good explanation of how it works. If anyone can look at it and analyze it, it would be good.
Report all collisions and suggest corrections. Thanks.

Do you have psuedocode of it or just written in a different language? Python is one of the few that I can't utilize, sorry.

WallShadow
Contributor

Posts: 686
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)

### Re: [DHA]: A new hashing algorithm

I ran a quick test on it by testing combinations of 3 characters ascii 32 to 126.
Code: Select all
`import itertools** DHA function here **def main():  print "[+] Running collision tester"  print "[+] Testing strings of length 1-3"  chars = ""  for i in range(32,126):    chars += chr(i)  print "[+] Testing strings with the following characters:\n" + chars  onechar = list(itertools.product(chars, repeat=1))  print "\n[+] Number of strings to test of length:\n\t1 char: " + str(len(onechar))  twochar = list(itertools.product(chars, repeat=2))  print "\t2 chars: " + str(len(twochar))  thrchar = list(itertools.product(chars, repeat=3))  print "\t3 chars: " + str(len(thrchar))  hashes = {}  total = onechar  total += twochar  total += thrchar  collisions = 0  for s in total:    #print "[+] testing '" + ''.join(s) + "'"    h = dha(''.join(s))    if not h in hashes:      hashes[h] = ''.join(s)    else:      collisions += 1      print "[-] " + ''.join(s) + ":" + h + " matches " + hashes[h] + ":" + h  print "[-] Total collisions found: " + str(collisions)`

It found 283915 collisions in combinations of just 3 characters...

It appears that # and / and , within strings caused many collisions. With just 2 char strings there are still plenty of collisions and it won't take as long to run as it does with 3 if you want to see the collisions for yourself. Just wrap your script up in a function call dha()
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.

fashizzlepop
Developer

Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)

### Re: [DHA]: A new hashing algorithm

Thanks. Looks like it is not secure at all. I better come up with DHA2.
payload
New User

Posts: 2
Joined: Tue Jan 01, 2013 3:10 pm
Blog: View Blog (0)

Return to Crypto

### Who is online

Users browsing this forum: No registered users and 0 guests