custom hash algorithm

cwarn23 1 Tallied Votes 993 Views Share

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);
}
nonshatter 26 Posting Whiz

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.

Alvin_5 0 Newbie Poster

This is what my OCD is telling me to do right now. Create a decryption method, improve the encryption, repeat.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Designing a strong hash function is a hard encryption problem. Verifying your own work is futile and usually wrong. Read Bruce Schneier's Applied Cryptography. Until you do, don't even think for a second that your work is "secure". I have written and adapted hashing functions in my work over the years, and I NEVER was able to equal the strength of those worked out by the experts in the field. Good stuff, perhaps. Adequate for our corporate internal use, maybe. But suitable for general use? I'm not that stupid!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.