login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Beveiliging > [hash] dolfje

[hash] dolfje

Auteur: Dolfje - 06 september 2005 - 20:14 - Gekeurd door: nemesiskoen - Hits: 5292 - Aantal punten: 5.00 (1 stem)





Deze class is een hash, zoals md5.
- Er is ervoor gezorgd dat (bijna) alles een andere uitkomst heeft (zoals md5)
- de uitkomst is 50 tekens groot (a-zA-Z0-9)

Code:
  1. <?
  2.  
  3. class hashen
  4. {
  5. var $hash = "";
  6. var $hash2 = "Ph2g£Qµ6:.Nc w?l;#!;(9MT7XJH!>,?@B}F(\\ç³d1`R*o²St+D]§prq^.emaUAC=ùfEy\"G)V\$x°&:In^KkY|<LWzv~Zsèi%{45¨_é-'b3u8/´Oj)[à";
  7.  
  8. var $abc = "HWEFjZgD7U3v4N5lapqX0Arh2tsnd6VuTLfJ81IxyQCBiweMKmRPOGbScz9oYk";
  9.  
  10. var $stringe = "";
  11. var $strlen = 0;
  12. var $strlen2 = 0;
  13. var $result = array();
  14. var $resulttekst = "";
  15. var $resulttekst2 = "";
  16.  
  17. function hash( $string )
  18. {
  19. $this->resulttekst2 = "";
  20. $this->resulttekst = "";
  21. $this->result= array();
  22. $this->strlen= 0;
  23. $this->strlen2= 0;
  24. $this->stringe= "";
  25. $this->hash=$this->hash2;
  26.  
  27. $string = $string."!";
  28. $string = str_replace("0","NULL",$string);
  29. $string = str_replace("\r\n","newline",$string);
  30. $string = str_replace("\n","newline",$string);
  31. $string = str_replace("\r","newline",$string);
  32. $string = str_replace("\t","tabbie",$string);
  33. $this->stringe = $string;
  34. unset($string);
  35.  
  36.  
  37. $this->strlen = strlen($this->stringe);
  38. $this->strlen2 = strlen($this->hash);
  39.  
  40. $stop = FALSE;
  41. $result = array();
  42. while( $stop == FALSE)
  43. {
  44. $result1 = $this->hashenfunctie();
  45. $this->hashendraai($result1);
  46. $this->hashentoevoeg( $result1 );
  47. if( count($this->result) > 100 )
  48. {
  49. $stop = TRUE;
  50. }
  51. }
  52.  
  53. for( $i = 0; !empty($this->result[$i]); $i++ )
  54. {
  55. $this->resulttekst .= $this->result[$i];
  56. }
  57.  
  58. for( $i = 0; substr($this->resulttekst,$i,2); $i+=2 )
  59. {
  60. $this->resulttekst2 .= substr($this->abc, substr($this->resulttekst,$i,2)/1.6 ,1);
  61. }
  62.  
  63. return substr($this->resulttekst2, -50, 50);
  64. }
  65. function hashentoevoeg( $result )
  66. {
  67. foreach( $result as $item=>$value )
  68. {
  69. $this->result[] = $item + $value;
  70. }
  71. }
  72.  
  73. function hashenfunctie()
  74. {
  75. for( $i=0; substr($this->stringe, $i, 1); $i++ )
  76. {
  77. $item = substr($this->stringe, $i, 1);
  78.  
  79. if( strpos($this->hash,$item) === FALSE )
  80. $this->hash .= $item;
  81. if( empty($result[ strpos($this->hash,$item) ] ) )
  82. $result[ strpos($this->hash,$item) ] = $i+substr_count($this->stringe, $item);
  83. }
  84. return $result;
  85. }
  86.  
  87. function hashendraai( $result )
  88. {
  89. $strlen3 = array_sum($result);
  90. $strlen3 += array_sum(array_flip($result));
  91. $strlen3 = (($strlen3/$this->strlen)/$this->strlen2)*1000000000000;
  92.  
  93. $strlen4 = floor($strlen3 / $this->strlen2)*$this->strlen2;
  94. $strlen5 = floor($strlen3)-floor($strlen4);
  95.  
  96. $hash1 = substr($this->hash, $strlen5);
  97. $hash2 = substr($this->hash, 0, $strlen5);
  98. $this->hash = $hash1.$hash2;
  99. }
  100. }
  101. $hash = new hashen;
  102. echo $hash->hash("hash");
  103.  
  104.  
  105. ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

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