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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:14:55+00:00 2026-05-21T11:14:55+00:00

Newbie here. I’m trying to encrypt the user password using SHA-256 after they’ve made

  • 0

Newbie here. I’m trying to encrypt the user password using SHA-256 after they’ve made their account and then when the user tries to log in, it will try to match their input with any of the encrypted passwords in the mysql database. I was wondering if someone could give me an example code?

  • 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-21T11:14:56+00:00Added an answer on May 21, 2026 at 11:14 am

    Hashing works one-way, so you cannot really ‘retrieve’ what you have hashed.

    When you save the password on registration, use something like this:

    $hash=hash('sha256', $password);
    

    And only save $hash in the database. When the user tries to log in, hash the password he tries to use and compare it to the one in the database (hashing will always give the same result for the same input). If they are the same, he can be logged in (if all additional checks are satisfied).

    If you want to let the user recover his forgotten pass, refer to this earlier question.

    Also, the best practice in hashing passwords is to use some kind of salt, which is out of the scope of this question, but please google it.

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

Sidebar

Related Questions

Javascript newbie here, trying to load Twitter profile images using the URLs returned by
WCF newbie here... I'm trying to self-host a WCF service using NetTcpBinding. Based on
Newbie here programming my first app (having made several tutorial apps). I am using
Java newbie here, I am trying to find the output of the following chunk
Android newbie here. I'm using this tutorial to show some rows that I fetch
Newbie here. I am trying to store the result of my search onto a
Newbie here with a frustrating, but probably simple question. I am trying to write
a newbie here. i have a menu, which using a jQuery slide effect. I
awk newbie here.. I'm trying this: top -b -p 30259 | awk 'BEGIN {
Django newbie here stumbling my way around the docs. I'm trying to create a

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.