login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Beveiliging > [hash] Lightblade

[hash] Lightblade

Auteur: MechaVore - 09 september 2005 - 19:23 - Gekeurd door: nemesiskoen - Hits: 5427 - 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.

  1. <?
  2. echo SD6("hier wat gehashed moet worden", 25, 40);
  3. ?>
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.

  1. <?
  2. echo SD6("Hash");
  3. ?>

Hier: http://www.sitemasters.be/web/scripts/SD6.zip
Er zit een bug in sima BTW..

Code:
  1. <?
  2. function SD6($input, $rate = 25, $length = 40)
  3. {
  4. if($input=="")
  5. {
  6. return false;
  7. }
  8. else
  9. {
  10. $char = array();
  11. for($i = 0; $i <= 255; $i++)
  12. {
  13. $char[] = chr($i);
  14. }
  15. $hsah[0] = "0";
  16. $hsah[1] = "q";
  17. $hsah[2] = "w";
  18. $hsah[3] = "e";
  19. $hsah[4] = "r";
  20. $hsah[5] = "t";
  21. $hsah[6] = "y";
  22. $hsah[7] = "u";
  23. $hsah[8] = "i";
  24. $hsah[9] = "o";
  25. $hsah[10] = "p";
  26. $hsah[11] = "a";
  27. $hsah[12] = "s";
  28. $hsah[13] = "d";
  29. $hsah[14] = "f";
  30. $hsah[15] = "g";
  31. $hsah[16] = "h";
  32. $hsah[17] = "j";
  33. $hsah[18] = "k";
  34. $hsah[19] = "l";
  35. $hsah[10] = "z";
  36. $hsah[20] = "x";
  37. $hsah[21] = "c";
  38. $hsah[22] = "v";
  39. $hsah[23] = "b";
  40. $hsah[24] = "n";
  41. $hsah[25] = "m";
  42. $hsah[26] = "M";
  43. $hsah[27] = "N";
  44. $hsah[28] = "B";
  45. $hsah[29] = "V";
  46. $hsah[30] = "C";
  47. $hsah[31] = "X";
  48. $hsah[32] = "Z";
  49. $hsah[33] = "L";
  50. $hsah[34] = "K";
  51. $hsah[35] = "J";
  52. $hsah[36] = "H";
  53. $hsah[37] = "G";
  54. $hsah[38] = "F";
  55. $hsah[39] = "D";
  56. $hsah[40] = "S";
  57. $hsah[41] = "A";
  58. $hsah[42] = "P";
  59. $hsah[43] = "O";
  60. $hsah[44] = "I";
  61. $hsah[45] = "U";
  62. $hsah[46] = "Y";
  63. $hsah[47] = "T";
  64. $hsah[48] = "R";
  65. $hsah[49] = "E";
  66. $hsah[50] = "W";
  67. $hsah[51] = "Q";
  68. $hsah[52] = "1";
  69. $hsah[53] = "2";
  70. $hsah[54] = "3";
  71. $hsah[55] = "4";
  72. $hsah[56] = "5";
  73. $hsah[57] = "6";
  74. $hsah[58] = "7";
  75. $hsah[59] = "8";
  76. $hsah[60] = "9";
  77. $string = $input;
  78. $input = strrev($input);
  79. $chars = strlen($input);
  80. $char1 = ceil($chars / 2);
  81. $char2 = $chars - $char1;
  82. $first = substr ($input, 0, $char1);
  83. $second = substr($input, $char1, $char2);
  84. $input = $second.$first;
  85. $abc = 1;
  86. for ($a = 0; $a < $chars; $a++)
  87. {
  88. $key = substr ($input, 0, 1);
  89. $input = substr ($input, 1, $chars-$a);
  90. for ($i = 0; $i <= 255; $i++)
  91. {
  92. if ($key == $char[$i])
  93. {
  94. $woord .= decbin($i);
  95. $spg[$abc++] = $i;
  96. }
  97. }
  98. }
  99. $input = $woord;
  100. $cryptchars = strlen($input) / 7;
  101. for ($a = 0; $a < $cryptchars; $a++)
  102. {
  103. $c = $a * 7;
  104. $key = substr ($input, $c, 7);
  105. $getal = $getal + bindec($key);
  106. }
  107. for ($a = 0; $a < $cryptchars; $a++)
  108. {
  109. $c = $a * 7;
  110. $key = substr ($input, $c, 7);
  111. $max[$a] = bindec($key) * $a;
  112. $max[$a] = $max[$a] * $getal;
  113. }
  114. for ($i = 0; $i < count($max); $i++)
  115. {
  116. $numcode = $numcode + $max[$i];
  117. }
  118. $varcode = $numcode / $getal;
  119. $seccode = $varcode;
  120. $karakter = 0;
  121. for ($a = 0; $a < $length; $a++)
  122. {
  123. $karakter++;
  124. if (!isset($spg[$karakter]))
  125. {
  126. $spg[$karakter] = 37;
  127. }
  128. $varcode = $seccode;
  129. $varcode = $varcode - $chars - $rate + $spg[$karakter] * $a - $a;
  130. $varcode = $varcode - $spg[$karakter] * $a + $chars * $getal + $spg[$karakter] - $a;
  131. $varcode = preg_replace('/-/', '', $varcode);
  132. $dtot = floor($varcode / 61);
  133. $bincode = 0;
  134. for ($i = 0; $i <= $dtot; $i++)
  135. {
  136. $bincode = $bincode + 61;
  137. }
  138. $kar = round($bincode - $varcode);
  139. $hash .= $hsah[$kar++];
  140. }
  141. $chars = strlen($hash);
  142. $char1 = ceil($chars / 2);
  143. $char2 = $chars - $char1;
  144. $first = substr ($hash, 0, $char1);
  145. $second = substr($hash, $char1, $char2);
  146. $hash = $second.$first;
  147. return $hash;
  148. }
  149. }
  150.  
  151. # Veilig
  152. echo SD6("password");
  153.  
  154. # Veiliger
  155. echo SD6("password", 132, 45);
  156. ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (3)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.048s