Last active
December 13, 2015 21:38
-
-
Save meghuizen/4978261 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
$iterations = 10000; | |
$msg = " | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc at dolor eget quam vehicula gravida. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean et lectus vitae dui viverra euismod. Vivamus eu magna eros, at accumsan est. Sed massa est, sodales vitae eleifend sed, placerat eu diam. Quisque vel risus nibh, at euismod massa. | |
Morbi sed augue neque. Suspendisse id tristique odio. Praesent bibendum scelerisque dolor ut placerat. Proin ut augue et dui hendrerit gravida eu a dolor. Pellentesque at enim elit. Mauris ac mauris elit. Maecenas tempor augue et libero dictum eu imperdiet nunc pharetra. Aliquam tempus euismod felis eget hendrerit. Curabitur eu fringilla neque. Aenean ut nisl magna, ac tincidunt tellus. Morbi erat turpis, egestas ac blandit nec, consectetur ut mauris. Nulla id ipsum eu diam vestibulum posuere sed vitae ante. Donec urna nunc, tincidunt id aliquet ut, aliquet eget metus. Pellentesque at gravida orci. | |
請在羽田機場國際航廈2樓入境大廳旁「京急旅遊服務中心」,購買方便又優惠的活動對象乘車券,或出示已在旅行代理店購買的活動對象之乘車券。"; | |
$nl = "\n"; | |
echo "<pre>"; | |
echo "Calculate HASH speeds:" . $nl; | |
$hashresults = array(); | |
foreach (hash_algos() as $algo) { | |
$starttime = microtime(TRUE); | |
for ($i = 0; $i < $iterations; $i++) { | |
$res = hash($algo, $msg); | |
} | |
$endtime = microtime(TRUE); | |
$hashresults[$algo] = ($endtime - $starttime); | |
} | |
asort($hashresults); | |
foreach ($hashresults as $algo => $time) { | |
echo "\t" . $algo . "\t\t" . ($time * 100) . 'ms' . $nl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment