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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:20:35+00:00 2026-05-31T20:20:35+00:00

I am working on a php/mysql login system for a webproject. After looking through

  • 0

I am working on a php/mysql login system for a webproject. After looking through SO and alot of articles on the web Ive come up with a basic framework and started writing some code for it. However Ive come to a bit of an impasse in password encryption.

After a nights worth of reading Ive found out that:

  • I should the users password with at least sha1 or sha2
  • I should also use a randomly generated salt (this is what I need help with) and append it to the password before encrypting it
  • the hashed password and the randomly generated salt should be stored in the database and then queried and combined/encrypted then checked against the users hashed password.

My problem is coming in randomly generating the salt,

  • 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-31T20:20:36+00:00Added an answer on May 31, 2026 at 8:20 pm

    Possibilities I can think of:

    • Use mt_rand() in a loop to pick an ASCII code, get the corresponding character with chr() and concatenate to salt.

      This allows to create salts with any length.

    • Define a string with available characters, use mt_rand() in a loop to pick random positions from it, extract the character in the selected position with substr() or mb_substr() and concatenate to salt.

      This allows to create salts with a chosen character set and length.

    • Use a builtin function that generates a random string (e.g. uniqid()) and optionally hash it.

      This is quick and simple.

    I normally use the second option.

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

Sidebar

Related Questions

I'm working on a web based system (PHP & MySQL) that has users who
I am working on an issue management system, developed in PHP/MySQL. It requires search
I'm currently working on creating a private messaging system, (PHP/MySQL) in which users can
I've got a login working flash >> PHP >> MYSQL and capable of doing
I'm currently learning PHP and MySQL and I have been working from a basic
Working on a web based buying and selling application with PHP MySQL where users
I'm actually working on a PHP project that will feature a user system (Login,Register,Send
I'm working on a PHP/MySQL rating system right now. For the user to be
With PHP and MySQL I am working on a user login type site. Here
My problem in fairly simple. I have a login system constructed using php, mysql

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.