diff --git a/costtest.php b/costtest.php new file mode 100644 index 0000000000000000000000000000000000000000..8f02fefd05c7b4ced9c815792edfb206c9ae594b --- /dev/null +++ b/costtest.php @@ -0,0 +1,14 @@ +<?php + +// $time = microtime(true); +// $option = [ +// 'cost' => 16, +// ]; +// echo password_hash("password", PASSWORD_BCRYPT, $option); +// echo "\nTook ". microtime((true) - $time) . " sec"; + +if (password_verify("raghav", '$2y$10$AQDHj9ymPO7To2vNlKvQXedzO4a/3s0aL3sEuh22bS/OMfaRKjzWm')) { + echo "Password correct"; +} else { + echo "Password Incorrect"; +} diff --git a/testhash.php b/testhash.php index 4da2be3651f91fb45a48b0a4e20000bb345879b6..100f65bb1d39ebfbb2f42e6e8418a71c65449c95 100644 --- a/testhash.php +++ b/testhash.php @@ -10,3 +10,16 @@ raghav; echo "string length: " . strlen($str) . "\n"; echo "md5: ". md5($str) . "(length: ". strlen(md5($str)) . ")\n"; echo "base64: ". base64_encode($str) . "\n(Length: ". strlen(base64_encode($str)) . ")"; + +// Testing type of hashing in php + + +$data = "hello"; + + + +foreach (hash_algos() as $v) { + + $r = hash($v, $data, false); + printf("%-12s %3d %s\n", $v, strlen($r), $r); +}