Questions tagged [php-password-hash]

Password hashing API to simplify creating and managing passwords in a way that they cannot be easily reversed. Replaces SHA1 and MD5 insecure hashing. Available natively with PHP 5.5.0+ or via an external compatibility package in PHP 5.3.7 and higher.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
129 views

Displaying non hashed password from database [duplicate]

<?php if(isset($_GET['edit_user'])){ $the_user_id = $_GET['edit_user']; $query = "SELECT * FROM users WHERE user_id = $the_user_id "; $select_user_by_id = mysqli_query($connection, $...
Equinius's user avatar
0 votes
0 answers
26 views

PHP - how to store password_hash results in an array? [duplicate]

I would like to hash multiple passwords from a MySQL table. $oConnexion = mysqli_connect(); $req1 = <<<SQL SELECT TX_PASSWORD_USR FROM sc_t_utilisateur as u SQL; $oRs1 = mysqli_query($...
Eferra83's user avatar
1 vote
0 answers
119 views

Object of class Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher could not be converted to string

I want generate faker users with symfony with Datafixtures and I hash users password with "UserPasswordHasher" but when I run the command " php bin/console doctrine:fixtures:load" ...
Halit Cinici's user avatar
2 votes
1 answer
94 views

PHP Password Hash Verifies on Hash Creation but Fails Verification with MySQL Query

I am building a dashboard system, with Apache running on a raspberry pi, and pre-generating a password and its hash for all new users. The line I used to do this is password_hash('Password1@', ...
thePuterNoob's user avatar
0 votes
1 answer
98 views

PHP - password_hash() Doesn't return anything after using ROT13

In my php file I have 3 variables, one that includes the clear password and one that includes the clear password after reversed from the ROT13 encryption and my last variable that contains the hashed ...
Fetert's user avatar
  • 91
0 votes
1 answer
667 views

Hashing and verifying user in login form PHP [duplicate]

I've created a simple login/registration form. The registered information is stored in a .txt file (this is for educational purposes only not real use). I am hashing the registered input before I put ...
Taipan's user avatar
  • 67
0 votes
0 answers
27 views

password_verify() how does it work with same password? [duplicate]

I'm wondering, if two users in the database have the same password, the password_hash() will create two different hashes, is that right? And if so, how does it do it? And how does it work with ...
Mizugorou's user avatar
0 votes
0 answers
158 views

Problems in password_verify() and password_hash(BCRYPT)

So I was making a login system with MySQL and PHP and found out about the password_hash() and password_verify() functions. Then, just for satisfaction, I tried it on paiza.io and it worked fine. Then, ...
Omer Hijazi's user avatar
0 votes
2 answers
3k views

Query builder update() codeigniter 4 not updateing my password

i'd like to ask some question. I want to make a change password feature in codeigniter 4, so i have to updateing my old password, but when i do that, the password it's not updated, but all my ...
KarolY's user avatar
  • 1
-1 votes
1 answer
105 views

Password Hashing and Password Verifying [duplicate]

I hashed a password through $hashedpassword = password_hash($Password, PASSWORD_DEFAULT); This stores the password as a hashed value into a database. But when I try to login in through $Password=$...
JakeL's user avatar
  • 1
1 vote
0 answers
438 views

Password_verify fails for password created on another server

I recently had to import mysql backup database to another server. My problem is the password_verify() function it fails to verify the password when I login. The php version of the both servers isPHP 7....
SilverSurfer's user avatar
  • 4,300
4 votes
2 answers
6k views

PHP Warning: Use of undefined constant PASSWORD_ARGON2ID when using password_hash() in php 7.3

I recently installed PHP 7.3.6 through Plesk's web GUI for a development copy of a web app, as I intend to update our production environment from php 7.0 to 7.3. I decided to take the opportunity to ...
Matt Aikens's user avatar
0 votes
1 answer
723 views

php password_hash() non used characters

Is there a list of characters not used to generate the hash in PHP's password_hash()? I'm looking for a quick/cheap way of indicating which proprietary algorythm or standard password_hash() was used ...
Viking NM's user avatar
  • 400
0 votes
1 answer
45 views

Verifying password hash in PHP

I know this should be simple but I'm having some trouble trying to verify the password hash during login. Had this in my registration handler: else { $hash = password_hash($pass, PASSWORD_BCRYPT)...
crumb on the floor's user avatar
0 votes
0 answers
38 views

PHP script that is supposed to hash a phrase but will output different hashes when the page is refreshed

I created a couple lines of PHP to generate a hashed password that I can copy and insert into a report however if I press refresh on the web page the hashed password will change. Is it something I am ...
craddrock's user avatar
1 vote
1 answer
3k views

I hash or encode my password using hash sha256 in PHP. I want to decode it. I doesn't use any key or salt

I hashing my password using below method in PHP $password=hash('sha256','123'); Now i want to decode it, how it is possible? I doesn't use any key or salt. <?php $password=hash('sha256','123'); ...
Spieder Man's user avatar
0 votes
0 answers
275 views

Argon2 5 threads is slower than 4 threads

I am using https://github.com/charlesportwoodii/php-argon2-ext to play around with Argon2. While i was playing with the parameters I noticed that the speed is not decreasing per core accordingly. See ...
Jordy's user avatar
  • 1
0 votes
1 answer
372 views

Problem with password_verify when create users with CodeIgniter

My problem is that I'm using CodeIgniter. I created an Administrator Panel which I use to create users and passwords. I use password_hash before sending them to database (in fact, in the database I ...
Peter's user avatar
  • 1
0 votes
1 answer
701 views

Validate password against hash in database in Yii2

What is wrong with this code? Even I enter a correct password still it returns "Old password is incorrect". I also tried $hash = Yii::$app->getSecurity->generatePasswordHash($...
beginner's user avatar
  • 2,024
-1 votes
2 answers
1k views

password_verify failing for password created on another server

I am running into a situation where I have two servers that sit behind a load balancer. I used password_hash() to generate a password on one server. Something basically like this password_hash('...
Xenology's user avatar
  • 2,417
1 vote
2 answers
234 views

Pulling a hashed username from MySQL database

I'm working on a project where both the username and password need to be hashed with Argon2. I'm not having any trouble hashing them both in the registration and inserting them into the database, but ...
Evan Edwards's user avatar
7 votes
1 answer
13k views

How to create wordpress password hash generator using php? [closed]

I want to create WordPress password hash using PHP like www.passwordtool.hu. An example: Password: admin321 Wordpress Password Hash: $1$8HmCMIeg$qv9z585yftJa2Hxqo7/RB/ For testing purpose here is ...
Muyin's user avatar
  • 113
0 votes
1 answer
164 views

Convert php register script from Sha1 to Bcrypt [duplicate]

So I have the password check for an old website defined as: if($i['password'] == hash('PASSWORD_BCRYPT',$p.$i['salt']) || sha1($p) == $i['password']) { and it uses the following to select data from ...
Vincent's user avatar
  • 99
1 vote
0 answers
1k views

Why does password_verify return false? [duplicate]

Why does password_verify return false? This question is intended to be canonical and has been created simply based on the amount of questions that have been asked on this topic.
Script47's user avatar
  • 14.3k
-1 votes
1 answer
144 views

Boost Up hashing speed with cost 20 or more

I'm using password_hash(myPassword,PASSWORD_DEFAULT,['cost'=>20]) in PHP. But it fails to execute the hashed password Fatal error: Maximum execution time of 30 seconds exceeded I use a ...
Ne ro's user avatar
  • 33
-1 votes
1 answer
83 views

php decrypt password does not work

encrypt the password in the database with the following code: $pas = $_POST['password']; $pass = password_hash($pas, PASSWORD_BCRYPT); in the solucioncontroller.php I try to verify the encrypted ...
ives rodriguez's user avatar
0 votes
2 answers
750 views

Can password_hash create the same hash in different times with the same parameters?

I PRETEND TO GENERATE UNIQUE RANDOM VALUE. Hello I been checking the functionality of password_hash and I need to know if it's possible to generate the same result if you use the same parameters. ...
Ricard Espinàs Llovet's user avatar
2 votes
3 answers
164 views

How to request for login with email and plain text password in cakephp3

I am new in php and working on REST API in cakephp3 for my android application. after setting up php and composer and routing I created login function.. public function login() { $this->...
Cruiser Raga S's user avatar
0 votes
2 answers
590 views

password_verify not working as expected when given hash stored in MySQL database

I am making an application in PHP with the CodeIgniter framework. I've managed to create a sign up page which enables users to enter their email address and password. I'm using the password_hash(...
Java Hermit's user avatar
-1 votes
1 answer
314 views

password_hash into MySQL database cutting off/out characters

I've been having trouble with storing a password_hash into my MySql database. It's cutting off characters from the beginning and some in between. I've tried setting the encoding to UTF 8 in the HTML, ...
Chris Hudson's user avatar
18 votes
1 answer
1k views

Argon2 Algorithm in PHP7: understanding the time_cost parameter

I'm trying to implement the Argon2 algorithm in an authentification library. I want to be able to provide some useful tips for the users to set the parameters. While I understand how memory_cost and ...
Indigo's user avatar
  • 790
0 votes
0 answers
401 views

FlexiAuth:password_hash(): Provided salt is too short: 20 expecting 22

I upgraded from Codeigniter 2.2.x to Codeigniter 3.0.x. Since my project uses FlexiAuth, I downloaded Reconix/Flexi-Auth-CI3 changes. The PHP version is PHP 5.6 However, when I try to login as an ...
user1072910's user avatar
0 votes
1 answer
75 views

How to match a inputted password to hashed password from database?

For some reasons, I don't know if I am really getting the hashed password from the database or if I am comparing it right to the inputted password. I have successfully tested my registration with the ...
Andrew Miranda's user avatar
0 votes
1 answer
99 views

Reset password link resets password but new password is not recognized by login.php

I created a forgot password link and everything works(password resets, token is set back to " ", password is properly hashed) but when I try to login with my new password, my script login.inc.php is ...
user avatar
2 votes
1 answer
501 views

Why does password_verify work on old passwords generated with crypt and a random salt?

I understand that password_hash returns the salt and hashing algorithm as part of the result, and so I get why password_verify works and will be backwards compatible with hashes generated by ...
Simone's user avatar
  • 156
2 votes
1 answer
891 views

PHP Escape All Characters In String

I am using PHP's password_hash() to store some of my passwords and I want to echo and get the stored hash from my database. However, when I try to I keep getting errors because certain characters aren'...
Fireal's user avatar
  • 47
36 votes
2 answers
34k views

How do I use the Argon2 algorithm with password_hash?

So I heard that PHP 7.2 introduced the new Argon2 algorithm. But I'm confused on how I can use it with my existing code. For instance, I have this $password = password_hash('somepassword', ...
Machavity's user avatar
  • 31.1k
7 votes
1 answer
2k views

What is the best way to hash a password? Is password_hash safe enough or is there a safer method in PHP 7?

What is the best way to hash a password? I know a way that does a good job, but I was wondering if there is an even better way to hash passwords in PHP 7+ then password_hash(). Is password_hash good ...
user avatar
0 votes
0 answers
24 views

Verifying salted MD5 passwords in a Bcrypt form [duplicate]

I am getting hashes and salts based on MD5 from a platform where users register.My platform is getting from a csv file the data of the new users(name,surname,username,password) and i have created a ...
anisaki nikol's user avatar
5 votes
3 answers
78k views

How to check username and password matches the database values

I'm really sorry if the question looks silly. But I've been trying for days to check my username and password in the database matches what I'm typing in the html page... This is my Login form... <...
Jananath Banuka's user avatar
-1 votes
1 answer
1k views

Password is failing to validate inside my login.php [duplicate]

When I register, it hashes the password and then puts the username and the hashed password into my local database. Works fine. When I try to login, the username and password don't match any in the ...
Maere's user avatar
  • 39
2 votes
1 answer
320 views

How to check a hashed password against database

I am looking to check the username and password that are entered are equal to the username and password stored in mysql database. I have used password_hash() to hash the password and stored them into ...
user avatar
0 votes
1 answer
72 views

Where to place password_verify() in php when logging in and have the registeration.php in an exernal file

I am trying to create a login.php script which uses password_verify() encryption. None of the topics were clear and the problem is that in every example it looks like this $password = '123'; $...
Evangelos's user avatar
0 votes
0 answers
430 views

PHP password_verify (BCRYPT) doesn't work, what am I doing wrong?

I'm quite new to PHP password_hash & password_verify. My password_hash works like a charm. I store the hash in the database 'password'-Field, after successful registration. But the main-problem ...
jerr0w's user avatar
  • 21
1 vote
2 answers
1k views

Is PHP's password_hash() Backwards Compatible?

Specifically, when using the PASSWORD_DEFAULT algorithm, as per the php page "Note that this constant is designed to change over time as new and stronger algorithms are added to PHP. For that reason,...
GregCatalano's user avatar
1 vote
1 answer
245 views

password_verify won't work after storing in database

I have been searching and reading for about 50 posts about my problem, but still can't figure out my problem, so I am here. Problem: password_verify() returns false even if password is correct. This ...
Crelix's user avatar
  • 349
0 votes
1 answer
90 views

how to verify the hashed password?

I am using CodeIgniter framework. Below is the function contained in the Signup.php controller. public function _hash_string($str){ $hashed_string = password_hash($str, PASSWORD_BCRYPT); ...
Qi Yang's user avatar
  • 69
0 votes
2 answers
250 views

password_verify not working despite trying all solutions bycrypt() [duplicate]

I have simple login system for which i am using bycrypt for security now the logic is simple i have echoed every variable everything looks good my column db is also varchar(255) so i dont have any ...
uneeb meer's user avatar
0 votes
1 answer
3k views

PHP password_verify not working against database

I'm trying to me a page more secure and I started with the password encrypting part of it. I'm trying to implement password_hash + password verify, but so far I've been unsuccessful to make the whole ...
Claudio's user avatar
  • 3,814
-3 votes
1 answer
1k views

pass in password_hash field with pdo [duplicate]

I am trying to process a password as md5 into the database, this is the concerned code: include_once("config.php"); session_start(); if(isset($_POST['signup'])){ $name = $_POST['name']; $...
user2371684's user avatar
  • 1,497