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 6376421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:44:33+00:00 2026-05-25T01:44:33+00:00

i just get one function from this site which describe that how to generate

  • 0

i just get one function from this site which describe that how to generate secure password using hash.
function is bellow

function hash_password($password, $nonce) {
  global $site_key;
  return hash_hmac('sha512', $password . $nonce, $site_key);
}

i am using this function like

$salt = sha1(rand()); 
$salt = substr($salt, 0, 4); 
$site_key="site.com";
$pass=hash_password($pass,$salt);

it generate random text on each time.
but i am unable to verify that password in database, as in database password is stored and this generate random text every time.

i want to know how can i use this function to

  1. Store Password in Database at time of user creation
  2. Verify Password from database at login

or

is there any other secure way?

Thanks

  • 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-05-25T01:44:34+00:00Added an answer on May 25, 2026 at 1:44 am

    You need to store the random string ($nonce I presume) in your database as part of the data, together with the resulting hash. Otherwise, you simply don’t have enough information to validate the password.

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

Sidebar

Related Questions

Just could not get this one and googling did not help much either.. First
Is there a one-line easy linq expression to just get everything from a simple
I have this Trigger in Postgresql that I can't just get to work (does
Say you just want to get rid of the changes you've made to one
How can I get all differences, not just one? I want to use the
I just get started using BDD in Rails application, but I'm not sure what
I just get a script from a website to put it on my own
I'm trying to build a site that runs without refreshes, using Jquery and PHP
I am creating a small search function on my site, this enables the search
I have a Wordpress site that uses two databases -- one section queries one

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.