lt.col.blair 0 Posted December 15, 2021 Is there a "simple" function in Delphi (using 10.3 Professional) that allows me to verify a password with a hash code generated in php using password_hash()? A function, that does the same as php's password_verify($password, $hash); Example: using php's password_hash('thisismyaccesscode', PASSWORD_DEFAULT) I have created this hash: $2y$10$21qire0Qwz/gj6HEej3tf.skdiZzeB.rgFdg7qD.5rAhE/AFg.U8q Now I'm looking for a Delphi function, that tells me, if the password entered into my program can be verified against this hash. Background: I have a list of user records for my web server. Using a webservice I can retrieve a user's password hash from that server. I know it is generated using the php function password_hash. I want to enable my users to login to my Delphi program using the access code from the web site. Therefore I get the password hash from the websever and want to verify it locally in my Delphi program instead of uploading the password to the server and checking with php. BTW: I posted the same question on Stack Overflow, but I think, this might the better platform to find solutions for Delphi questions. Share this post Link to post
Fr0sT.Brutal 900 Posted December 15, 2021 Read in docs what hash algo password_hash() uses Search implementation of this algo for Delphi Write primitive verification routine Share this post Link to post
Virgo 18 Posted December 16, 2021 Particular hash is bcrypt. https://github.com/JackTrapper/bcrypt-for-delphi supports it. But it is not universal, because it does not support other algorithms supported by password_hash. Share this post Link to post
Rollo62 536 Posted December 16, 2021 Maybe thats more current, from Vinicius Sanchez Share this post Link to post