
- PHP Tutorial
- PHP - Home
- PHP - Introduction
- PHP - Environment Setup
- PHP - Syntax Overview
- PHP - Variable Types
- PHP - Constants
- PHP - Operator Types
- PHP - Decision Making
- PHP - Loop Types
- PHP - Arrays
- PHP - Strings
- PHP - Web Concepts
- PHP - GET & POST
- PHP - File Inclusion
- PHP - Files & I/O
- PHP - Functions
- PHP - Cookies
- PHP - Sessions
- PHP - Sending Emails
- PHP - File Uploading
- PHP - Coding Standard
- Advanced PHP
- PHP - Predefined Variables
- PHP - Regular Expression
- PHP - Error Handling
- PHP - Bugs Debugging
- PHP - Date & Time
- PHP & MySQL
- PHP & AJAX
- PHP & XML
- PHP - Object Oriented
- PHP - For C Developers
- PHP - For PERL Developers
- PHP Form Examples
- PHP - Form Introduction
- PHP - Validation Example
- PHP - Complete Form
- PHP login Examples
- PHP - Login Example
- PHP - Facebook Login
- PHP - Paypal Integration
- PHP - MySQL Login
- PHP AJAX Examples
- PHP - AJAX Search
- PHP - AJAX XML Parser
- PHP - AJAX Auto Complete Search
- PHP - AJAX RSS Feed Example
- PHP XML Example
- PHP - XML Introduction
- PHP - Simple XML
- PHP - Simple XML GET
- PHP - SAX Parser Example
- PHP - DOM Parser Example
- PHP Frame Works
- PHP - Frame Works
- PHP - Core PHP vs Frame Works
- PHP Design Patterns
- PHP - Design Patterns
- PHP Function Reference
- PHP - Built-In Functions
- PHP Useful Resources
- PHP - Questions & Answers
- PHP - Useful Resources
- PHP - Discussion
PHP password_verify() Function
The password_verify() function can verify that a password matches a hash.
Syntax
boolean password_verify( string $password , string $hash )
The password_verify() function can verify that given hash matches the given password.
Note that the password_hash() function can return the algorithm, cost, and salt as part of a returned hash. Therefore, all information that needs to verify a hash that includes in it. This can allow the password_verify() function to verify a hash without need separate storage for the salt or algorithm information.
The password_verify() function can return true, if the password and hash match, or false otherwise.
Example 1
<?php $passw01 = "53nh46u74m3nt3"; $hashp02 = '$argon2i$v=19$m=1024,t=2,p=2$d1JJWnNHMkVEekZwcTFUdA$zeSi7c/Adh/1KCTHddoF39Xxwo9ystxRzHEnRA0lQeM'; $test02 = password_verify($passw01, $hashp02); if($test02 == true) { echo "VALID password for the informed HASH!<br>"; var_dump($test02); } else { echo "INVALID password for the informed HASH!<br>"; var_dump($test02); } ?>
Output
INVALID password for the informed HASH!<br>bool(false)
Example 2
Output
VALID password for the informed HASH!<br>bool(true) <br><br>algo = argon2i<br>algoName = argon2i<br>memory_cost = 1024<br>time_cost = 2<br>threds = 2<br><br>
php_function_reference.htm
Advertisements