Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:38:31+00:00 2026-06-16T21:38:31+00:00

I am basing my bcrypt creating off of this site I have made some

  • 0

I am basing my bcrypt creating off of this site
I have made some changes to it though so this is my version of the code : My version of bcrypt

I have started working on my login form and I have come the general understanding that to check a users credentials you must :

  1. recreate the bcrypt

  2. compare what the $_POST[‘password’] that is being submitted to the password you have stored in the database.

  3. return a row count so if a row is returned where the password
    that you recreated matches the already stored password then the row
    count must == 1

What I am confused about :

  1. How do I let the checklogin form know what the bcrypt function was to
    begin with? do I have to include the register script? – or do I have
    to copy and paste the bcrypt function?

I have tried to implement this on my user authentication and for some reason it is not working for me.

This is my code hopfully some one sees a problem that i dont.

Any help would be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:38:33+00:00Added an answer on June 16, 2026 at 9:38 pm

    What your code is trying to do is similar to how the old md5() unsalted hashes were looked up; php calculates the hash and then the database lookup is done based on that hash value and the user name.

    Because your code is using a different salt each time when it needs to verify a given password, the lookup in the database would practically never work.

    With bcrypt it works like this:

    1. Fetch the database record based on the user name.

    2. Use the stored password hash in there to compare against the posted password:

      if (crypt($form_password, $db_hash) === $db_hash) { ... }
      

    Tips

    Generating a salt for bcrypt can be much easier (you don’t need 10k characters):

    rtrim(strtr(base64_encode(openssl_random_pseudo_bytes(16)), '+', '.'), '=');
    

    Also, the cost parameter of 17 is really big … unless you’re running serious hardware, you’re going to bring down the site when someone tries to brute force a password.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been basing this code off the Bluetooth Chat example. It worked when it
I'm heavily basing my code off of this excellent tutorial at Ars Technica, so
I have a dropdown.Basing on this dropdown i shud load another dropdown.i wrote code
here is a link to what im basing my code off of....but i want
Basing on this response I have learnt which I must use MultipartEntity in order
I've been working on implementing in-app billing, basing it off of blundell's tutorial here:
Basing on this topic , I put down an interesting version of Singleton pattern
I have this code on my products view.phtml file: I am getting a shipping
I have the following code. The code populates a list box basing on the
I have a code for the micro-controller in C. Basing on the examples I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.