[hash] Lightblade
Auteur: MechaVore - 09 september 2005 - 19:23 - Gekeurd door: nemesiskoen - Hits: 5508 - Aantal punten: 3.88 (4 stemmen)
SD6 staat voor Secure Data 6. Ik weet niet waarom maar ik moet toch een naam geven
. Het genereert een hash, je kan zelf bepalen hoeveel karakters de hash bevat en je kan een waarde instellen voor jouw unieke hash.
<?
echo SD6("hier wat gehashed moet worden", 25, 40);
?>
<?
echo SD6
( "hier wat gehashed moet worden" , 25 , 40 ) ; ?>
Dit maakt een hash van 40 karakters met range 25. Dus alleen als hij op 25 staat krijg je die hash. Het is ook te gebruiken zonder de 25 of 40 maar dan worden de standaardwaarden ingesteld.
Hier: http://www.sitemasters.be/web/scripts/SD6.zip
Er zit een bug in sima BTW..
Code:
<?
function SD6($input, $rate = 25, $length = 40)
{
if($input=="")
{
return false;
}
else
{
$char = array();
for($i = 0; $i <= 255; $i++)
{
$char[] = chr($i);
}
$hsah[0] = "0";
$hsah[1] = "q";
$hsah[2] = "w";
$hsah[3] = "e";
$hsah[4] = "r";
$hsah[5] = "t";
$hsah[6] = "y";
$hsah[7] = "u";
$hsah[8] = "i";
$hsah[9] = "o";
$hsah[10] = "p";
$hsah[11] = "a";
$hsah[12] = "s";
$hsah[13] = "d";
$hsah[14] = "f";
$hsah[15] = "g";
$hsah[16] = "h";
$hsah[17] = "j";
$hsah[18] = "k";
$hsah[19] = "l";
$hsah[10] = "z";
$hsah[20] = "x";
$hsah[21] = "c";
$hsah[22] = "v";
$hsah[23] = "b";
$hsah[24] = "n";
$hsah[25] = "m";
$hsah[26] = "M";
$hsah[27] = "N";
$hsah[28] = "B";
$hsah[29] = "V";
$hsah[30] = "C";
$hsah[31] = "X";
$hsah[32] = "Z";
$hsah[33] = "L";
$hsah[34] = "K";
$hsah[35] = "J";
$hsah[36] = "H";
$hsah[37] = "G";
$hsah[38] = "F";
$hsah[39] = "D";
$hsah[40] = "S";
$hsah[41] = "A";
$hsah[42] = "P";
$hsah[43] = "O";
$hsah[44] = "I";
$hsah[45] = "U";
$hsah[46] = "Y";
$hsah[47] = "T";
$hsah[48] = "R";
$hsah[49] = "E";
$hsah[50] = "W";
$hsah[51] = "Q";
$hsah[52] = "1";
$hsah[53] = "2";
$hsah[54] = "3";
$hsah[55] = "4";
$hsah[56] = "5";
$hsah[57] = "6";
$hsah[58] = "7";
$hsah[59] = "8";
$hsah[60] = "9";
$string = $input;
$input = strrev($input);
$chars = strlen($input);
$char1 = ceil($chars / 2);
$char2 = $chars - $char1;
$first = substr ($input, 0, $char1);
$second = substr($input, $char1, $char2);
$input = $second.$first;
$abc = 1;
for ($a = 0; $a < $chars; $a++)
{
$key = substr ($input, 0, 1);
$input = substr ($input, 1, $chars-$a);
for ($i = 0; $i <= 255; $i++)
{
if ($key == $char[$i])
{
$woord .= decbin($i);
$spg[$abc++] = $i;
}
}
}
$input = $woord;
$cryptchars = strlen($input) / 7;
for ($a = 0; $a < $cryptchars; $a++)
{
$c = $a * 7;
$key = substr ($input, $c, 7);
$getal = $getal + bindec($key);
}
for ($a = 0; $a < $cryptchars; $a++)
{
$c = $a * 7;
$key = substr ($input, $c, 7);
$max[$a] = bindec($key) * $a;
$max[$a] = $max[$a] * $getal;
}
for ($i = 0; $i < count($max); $i++)
{
$numcode = $numcode + $max[$i];
}
$varcode = $numcode / $getal;
$seccode = $varcode;
$karakter = 0;
for ($a = 0; $a < $length; $a++)
{
$karakter++;
if (!isset($spg[$karakter]))
{
$spg[$karakter] = 37;
}
$varcode = $seccode;
$varcode = $varcode - $chars - $rate + $spg[$karakter] * $a - $a;
$varcode = $varcode - $spg[$karakter] * $a + $chars * $getal + $spg[$karakter] - $a;
$varcode = preg_replace('/-/', '', $varcode);
$dtot = floor($varcode / 61);
$bincode = 0;
for ($i = 0; $i <= $dtot; $i++)
{
$bincode = $bincode + 61;
}
$kar = round($bincode - $varcode);
$hash .= $hsah[$kar++];
}
$chars = strlen($hash);
$char1 = ceil($chars / 2);
$char2 = $chars - $char1;
$first = substr ($hash, 0, $char1);
$second = substr($hash, $char1, $char2);
$hash = $second.$first;
return $hash;
}
}
# Veilig
echo SD6("password");
# Veiliger
echo SD6("password", 132, 45);
?>
<?
function SD6( $input , $rate = 25 , $length = 40 )
{
if ( $input == "" )
{
return false ;
}
else
{
for ( $i = 0 ; $i <= 255 ; $i ++ )
{
}
$hsah [ 0 ] = "0" ;
$hsah [ 1 ] = "q" ;
$hsah [ 2 ] = "w" ;
$hsah [ 3 ] = "e" ;
$hsah [ 4 ] = "r" ;
$hsah [ 5 ] = "t" ;
$hsah [ 6 ] = "y" ;
$hsah [ 7 ] = "u" ;
$hsah [ 8 ] = "i" ;
$hsah [ 9 ] = "o" ;
$hsah [ 10 ] = "p" ;
$hsah [ 11 ] = "a" ;
$hsah [ 12 ] = "s" ;
$hsah [ 13 ] = "d" ;
$hsah [ 14 ] = "f" ;
$hsah [ 15 ] = "g" ;
$hsah [ 16 ] = "h" ;
$hsah [ 17 ] = "j" ;
$hsah [ 18 ] = "k" ;
$hsah [ 19 ] = "l" ;
$hsah [ 10 ] = "z" ;
$hsah [ 20 ] = "x" ;
$hsah [ 21 ] = "c" ;
$hsah [ 22 ] = "v" ;
$hsah [ 23 ] = "b" ;
$hsah [ 24 ] = "n" ;
$hsah [ 25 ] = "m" ;
$hsah [ 26 ] = "M" ;
$hsah [ 27 ] = "N" ;
$hsah [ 28 ] = "B" ;
$hsah [ 29 ] = "V" ;
$hsah [ 30 ] = "C" ;
$hsah [ 31 ] = "X" ;
$hsah [ 32 ] = "Z" ;
$hsah [ 33 ] = "L" ;
$hsah [ 34 ] = "K" ;
$hsah [ 35 ] = "J" ;
$hsah [ 36 ] = "H" ;
$hsah [ 37 ] = "G" ;
$hsah [ 38 ] = "F" ;
$hsah [ 39 ] = "D" ;
$hsah [ 40 ] = "S" ;
$hsah [ 41 ] = "A" ;
$hsah [ 42 ] = "P" ;
$hsah [ 43 ] = "O" ;
$hsah [ 44 ] = "I" ;
$hsah [ 45 ] = "U" ;
$hsah [ 46 ] = "Y" ;
$hsah [ 47 ] = "T" ;
$hsah [ 48 ] = "R" ;
$hsah [ 49 ] = "E" ;
$hsah [ 50 ] = "W" ;
$hsah [ 51 ] = "Q" ;
$hsah [ 52 ] = "1" ;
$hsah [ 53 ] = "2" ;
$hsah [ 54 ] = "3" ;
$hsah [ 55 ] = "4" ;
$hsah [ 56 ] = "5" ;
$hsah [ 57 ] = "6" ;
$hsah [ 58 ] = "7" ;
$hsah [ 59 ] = "8" ;
$hsah [ 60 ] = "9" ;
$string = $input ;
$char1 = ceil ( $chars / 2 ) ; $char2 = $chars - $char1 ;
$first = substr ( $input , 0 , $char1 ) ; $second = substr ( $input , $char1 , $char2 ) ; $input = $second . $first ;
$abc = 1 ;
for ( $a = 0 ; $a < $chars ; $a ++ )
{
$input = substr ( $input , 1 , $chars - $a ) ; for ( $i = 0 ; $i <= 255 ; $i ++ )
{
if ( $key == $char [ $i ] )
{
$spg [ $abc ++ ] = $i ;
}
}
}
$input = $woord ;
$cryptchars = strlen ( $input ) / 7 ; for ( $a = 0 ; $a < $cryptchars ; $a ++ )
{
$c = $a * 7 ;
$key = substr ( $input , $c , 7 ) ; $getal = $getal + bindec ( $key ) ; }
for ( $a = 0 ; $a < $cryptchars ; $a ++ )
{
$c = $a * 7 ;
$key = substr ( $input , $c , 7 ) ; $max [ $a ] = $max [ $a ] * $getal ;
}
for ( $i = 0 ; $i < count ( $max ) ; $i ++ ) {
$numcode = $numcode + $max [ $i ] ;
}
$varcode = $numcode / $getal ;
$seccode = $varcode ;
$karakter = 0 ;
for ( $a = 0 ; $a < $length ; $a ++ )
{
$karakter ++;
if ( ! isset ( $spg [ $karakter ] ) ) {
$spg [ $karakter ] = 37 ;
}
$varcode = $seccode ;
$varcode = $varcode - $chars - $rate + $spg [ $karakter ] * $a - $a ;
$varcode = $varcode - $spg [ $karakter ] * $a + $chars * $getal + $spg [ $karakter ] - $a ;
$dtot = floor ( $varcode / 61 ) ; $bincode = 0 ;
for ( $i = 0 ; $i <= $dtot ; $i ++ )
{
$bincode = $bincode + 61 ;
}
$kar = round ( $bincode - $varcode ) ; $hash .= $hsah [ $kar ++ ] ;
}
$char1 = ceil ( $chars / 2 ) ; $char2 = $chars - $char1 ;
$first = substr ( $hash , 0 , $char1 ) ; $second = substr ( $hash , $char1 , $char2 ) ; $hash = $second . $first ;
return $hash ;
}
}
# Veilig
# Veiliger
echo SD6
( "password" , 132 , 45 ) ; ?>
Download code (.txt)
Stemmen
Niet ingelogd.