Last active
May 23, 2017 07:32
-
-
Save JudeRosario/14a6eefedf7e78a6bc176c8ea7d42012 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$trie = new Trie(); | |
$start = microtime(true); | |
for ( $i = 0 ; $i < 20000000 ; $i++ ) { | |
$sid = bin2hex(openssl_random_pseudo_bytes(8)); | |
$collision = $trie->search($sid) ; | |
if ( is_null($collision) ) { | |
$trie->add($sid, 1); | |
} else { | |
echo "\n" ."Collision with previous Hash" ."\n" ; | |
} | |
} | |
$time_elapsed_secs = microtime(true) - $start; | |
echo "\n" . " Time Elapsed :" . $time_elapsed_secs . "\n" ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment