[hash] dolfje
Auteur: Dolfje - 06 september 2005 - 20:14 - Gekeurd door: nemesiskoen - Hits: 5464 - 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: |
<?
class hashen
{
var $hash = "";
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)[à";
var $abc = "HWEFjZgD7U3v4N5lapqX0Arh2tsnd6VuTLfJ81IxyQCBiweMKmRPOGbScz9oYk";
var $stringe = "";
var $strlen = 0;
var $strlen2 = 0;
var $result = array();
var $resulttekst = "";
var $resulttekst2 = "";
function hash( $string )
{
$this->resulttekst2 = "";
$this->resulttekst = "";
$this->result= array();
$this->strlen= 0;
$this->strlen2= 0;
$this->stringe= "";
$this->hash=$this->hash2;
$string = $string."!";
$string = str_replace("0","NULL",$string);
$string = str_replace("\r\n","newline",$string);
$string = str_replace("\n","newline",$string);
$string = str_replace("\r","newline",$string);
$string = str_replace("\t","tabbie",$string);
$this->stringe = $string;
unset($string);
$this->strlen = strlen($this->stringe);
$this->strlen2 = strlen($this->hash);
$stop = FALSE;
$result = array();
while( $stop == FALSE)
{
$result1 = $this->hashenfunctie();
$this->hashendraai($result1);
$this->hashentoevoeg( $result1 );
if( count($this->result) > 100 )
{
$stop = TRUE;
}
}
for( $i = 0; !empty($this->result[$i]); $i++ )
{
$this->resulttekst .= $this->result[$i];
}
for( $i = 0; substr($this->resulttekst,$i,2); $i+=2 )
{
$this->resulttekst2 .= substr($this->abc, substr($this->resulttekst,$i,2)/1.6 ,1);
}
return substr($this->resulttekst2, -50, 50);
}
function hashentoevoeg( $result )
{
foreach( $result as $item=>$value )
{
$this->result[] = $item + $value;
}
}
function hashenfunctie()
{
for( $i=0; substr($this->stringe, $i, 1); $i++ )
{
$item = substr($this->stringe, $i, 1);
if( strpos($this->hash,$item) === FALSE )
$this->hash .= $item;
if( empty($result[ strpos($this->hash,$item) ] ) )
$result[ strpos($this->hash,$item) ] = $i+substr_count($this->stringe, $item);
}
return $result;
}
function hashendraai( $result )
{
$strlen3 = array_sum($result);
$strlen3 += array_sum(array_flip($result));
$strlen3 = (($strlen3/$this->strlen)/$this->strlen2)*1000000000000;
$strlen4 = floor($strlen3 / $this->strlen2)*$this->strlen2;
$strlen5 = floor($strlen3)-floor($strlen4);
$hash1 = substr($this->hash, $strlen5);
$hash2 = substr($this->hash, 0, $strlen5);
$this->hash = $hash1.$hash2;
}
}
$hash = new hashen;
echo $hash->hash("hash");
?>
<? class hashen { var $hash = ""; 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)[à"; var $abc = "HWEFjZgD7U3v4N5lapqX0Arh2tsnd6VuTLfJ81IxyQCBiweMKmRPOGbScz9oYk"; var $stringe = ""; var $strlen = 0; var $strlen2 = 0; var $resulttekst = ""; var $resulttekst2 = ""; function hash( $string ) { $this->resulttekst2 = ""; $this->resulttekst = ""; $this->strlen= 0; $this->strlen2= 0; $this->stringe= ""; $this->hash=$this->hash2; $string = $string."!"; $this->stringe = $string; $this->strlen = strlen($this->stringe); $this->strlen2 = strlen($this->hash); $stop = FALSE; while( $stop == FALSE) { $result1 = $this->hashenfunctie(); $this->hashendraai($result1); $this->hashentoevoeg( $result1 ); if( count($this->result) > 100 ) { $stop = TRUE; } } for( $i = 0; !empty($this->result[$i]); $i++ ) { $this->resulttekst .= $this->result[$i]; } for( $i = 0; substr($this->resulttekst,$i,2); $i+=2 ) { $this->resulttekst2 .= substr($this->abc, substr($this->resulttekst,$i,2)/1.6 ,1); } return substr($this->resulttekst2, -50, 50); } function hashentoevoeg( $result ) { foreach( $result as $item=>$value ) { $this->result[] = $item + $value; } } function hashenfunctie() { for( $i=0; substr($this->stringe, $i, 1); $i++ ) { $item = substr($this->stringe, $i, 1); if( strpos($this->hash,$item) === FALSE ) $this->hash .= $item; } return $result; } function hashendraai( $result ) { $strlen3 = (($strlen3/$this->strlen)/$this->strlen2)*1000000000000; $strlen4 = floor($strlen3 / $this->strlen2)*$this->strlen2; $hash1 = substr($this->hash, $strlen5); $hash2 = substr($this->hash, 0, $strlen5); $this->hash = $hash1.$hash2; } } $hash = new hashen; echo $hash->hash("hash"); ?>
Download code (.txt)
|
|
Stemmen |
Niet ingelogd. |
|