summaryrefslogtreecommitdiffstats
path: root/bench.php
diff options
context:
space:
mode:
Diffstat (limited to 'bench.php')
-rw-r--r--bench.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/bench.php b/bench.php
new file mode 100644
index 0000000..a5bc09b
--- /dev/null
+++ b/bench.php
@@ -0,0 +1,37 @@
+<?php
+
+$deb = microtime(true);
+echo 'PASSWORD_BCRYPT: ';
+for($i=0; $i<10; $i++) {
+ $h = password_hash("secret$i", PASSWORD_BCRYPT);
+}
+printf("%.3f\"\n", microtime(true) - $deb);
+
+$deb = microtime(true);
+echo 'PASSWORD_ARGON2I: ';
+for($i=0; $i<10; $i++) {
+ $h = password_hash("secret$i", PASSWORD_ARGON2I);
+}
+printf("%.3f\"\n", microtime(true) - $deb);
+
+$deb = microtime(true);
+echo 'PASSWORD_ARGON2ID: ';
+for($i=0; $i<10; $i++) {
+ $h = password_hash("secret$i", PASSWORD_ARGON2ID);
+}
+printf("%.3f\"\n", microtime(true) - $deb);
+
+$deb = microtime(true);
+echo 'PASSWORD_SHA512: ';
+for($i=0; $i<10; $i++) {
+ $h = password_hash("secret$i", PASSWORD_SHA512);
+}
+printf("%.3f\"\n", microtime(true) - $deb);
+
+$deb = microtime(true);
+echo 'PASSWORD_YESCRYPT: ';
+for($i=0; $i<10; $i++) {
+ $h = password_hash("secret$i", PASSWORD_YESCRYPT);
+}
+printf("%.3f\"\n", microtime(true) - $deb);
+