954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

custom hash algorithm

By cwarn23 on Dec 3rd, 2010 5:50 pm

Don't you just get sick of hash algorithms constantly been brute forced or even cracked. Well here is an algorithm I have created in my spare time to help out the little guy who just wants a secure hash. This hashing algorithm uses many different techniques including ones used in sha1 to prevent a reversal algorithm and uses a lot of math to help reduce the speed of brute forcing the algorithm.

An example of the brute force done on common algorithms today is like I myself have got a website to brute force sha1, sha256, sha512, md4 and md5. Currently I am using a i7 3.2GHz 4 core 8 threads but in just over a year I will have in addition to that, another machine with an Xeon 2.27GHz 16 core 32 threads where there are 2x 8 core cpu boards connected to the motherboard doubling the performance along with 18TB of harddrive space and 9 individual hard drives. And I'm not the only one doing this. I have seen people who own 6 servers each with an Xeon processor 2.27GHz 8 core each. The conclusion, don't use a staight foward pre-made algorithm that has been around for a while. Instead hash a substr() of a hash or make a custom algorithm like this so that nobody can use pre-existing databases to reverse a hash.

<?php
function ura32($string) {
//UncRackable Algorithm - 32 bit hash
$subchar=str_split($string,ceil(strlen($string)/80));
for ($i=0;$i<count($subchar);$i++) {
   $char=str_split(chr(255).$subchar[$i].chr(127),1);
   $c=0;
   for ($j=0;$j<count($char);$j++) {
      $char[$j]=ord($char[$j]);
      if ($j<3) {
          $c=($c*$j)<<2;
          }
      elseif ($j==3) {
          $c=(($c-2)*($j/2)<<4);
          }
      elseif ($j%3==0) {
          $c=(($c&$j)^$c);
          $d=$j;
          }
      elseif ($j%3==1) {
          $c=($c|((($c+1)/(1+($j*$d)))));
          $d=($j>$d)?($j-$d):(($d-$j)+1);
          }
      else {
          $c=(($c%255)+$d)^$c;
          }
      }
   if ($i%2==0) {
   $res[79-$i]=$c;
   } else {
   $res[$i]=$c;
   }
   $c=0;
   }
$result='';
$char=str_split($string.str_repeat(ord(0),80),1);
for ($i=0;$i<79;$i+=4) {
$result.=dechex(((($res[$i]+$res[$i+1]+1)*($res[$i+2]+1))*($res[$i+3]+1))+($i*128));
}
return substr($result,0,64);
}

Finding a secure hash function is quite a challenging and often overlooked task, so thanks for this share! I haven't tested this yet, but I'm sure this will come in handy for many of us.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 63
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: