Skip to content
Snippets Groups Projects
Commit bc0641b5 authored by Raghav's avatar Raghav
Browse files

Tested with password functions

parent e7cb71f4
No related branches found
No related tags found
No related merge requests found
<?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";
}
......@@ -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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment