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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:34:17+00:00 2026-05-16T08:34:17+00:00

This question is about a specific programming problem I am having – I want

  • 0

This question is about a specific programming problem I am having – I want to make sure that my code (and software algorithm) are sufficient enough to store user credentials in a database.

// Get a 32 character salt like '69Mt6nexL1rsjWnu011S53MpB/WmT4Vl'
$passwordSalt = Security::generateBase64Salt();

$user = new User();
$user->setUsername($_POST['username']);

// $_POST['password'] comes in as a 128 character string
// Client side javascript is used to sha512 the string before sending it over POST
// see http://pajhome.org.uk/crypt/md5/
// This prevents novice eavesdroppers from capturing the raw password in plaintext
$user->setPassword(
    hash('sha512', $passwordSalt.$_POST['password'])
);
$user->setPasswordSalt($passwordSalt);
$user->save();

Here’s the database entry for a particular password:

alt text

Password:

69a78a7586a111b8a567b2d4f42f93f01fb59d337f7fa3c35949a66b246095778c1fa01ff4026abace476091e1e9a183bbdec1c31b12ce3f786921895c98cf6f

Salt:

69Mt6nexL1rsjWnu011S53MpB/WmT4Vl

Questions:

  • Are there any inherit flaws with this algorithm?
  • Is it OK to store the salt in the same database and table as the salt+password hash?
  • Will having a large 128 character password cause login performance issues (on a magnitude of several seconds) if I have several hundred thousand users in the table?
  • Can this data be reversed to produce the original password?

For Fun:

I’ll PayPal you $5 if you can provide me with the original password using the salt and salt + password hash.

  • 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-16T08:34:17+00:00Added an answer on May 16, 2026 at 8:34 am

    Are there any inherit flaws with this algorithm?

    It’s not open to rainbow attacks (due to the random salt). Sha512 is a fairly new algorithm, but currently has no known collisions, so it’s probably pretty safe. The way your storing passwords is done well. The checking process is also important (rate limiting bruteforce attacks) and locking down the servers from attacks from other angles which could try to get access to the database. If an attacker was able to gain access to the database, he could probably extract out simple passwords fairly quickly, but any complex password would probably beyond a simple bruteforce attack (even if he had direct access to the hashes).

    Is it OK to store the salt in the same database and table as the salt+password hash?

    You pretty much have to store them together if you want to be able to validate the passwords (I assume you want to). The main reason for salting a password is to remove the possibility of a rainbow attack. Often this data is even stored in the same column as the hashed password using a symbol to separate them.

    Will having a large 128 character password cause login performance issues (on a magnitude of several seconds) if I have several hundred thousand users in the table?

    Benchmark how long (in seconds) it takes to check a password (hash('sha512', $salt.$password_attempt )). Find the inverse of that number, and that’s probably close to how many password attempts you can handle per second per CPU core.

    Can this data be reversed to produce the original password?

    Yes, but it would take alot of effort, since your using a random salt, rainbow tables will no longer work, and sha512 takes a fair amount of CPU to run and has no known collisions. If the password was fairly simple it could be guessed. If your worried about reversing the hashes, putting a low bound on the complexity of the password might be a good idea (checking it against a dictionary, does it contain upper/lower/numbers/symbols).

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

Sidebar

Ask A Question

Stats

  • Questions 495k
  • Answers 495k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your $results array is one-dimensional - it has an ID… May 16, 2026 at 11:24 am
  • Editorial Team
    Editorial Team added an answer you can check the device SDK version using inbuilt classes… May 16, 2026 at 11:24 am
  • Editorial Team
    Editorial Team added an answer The @ is an xpath selector (has attribute), which has… May 16, 2026 at 11:24 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is not really a programming question, more of an algorithmic one. The problem:
I've been having a problem with making sorted lists from dictionaries. I have this
I have a continuous linear programming problem that involves maximizing a linear function over
Firstly, this is not a question about repository synchronisation for which there are numerous
Wikipedia used to say* about duck-typing : In computer programming with object-oriented programming languages,
here's a problem I've solved from a programming problem website(codechef.com in case anyone doesn't
This stems from a related discussion, How to subtract specific elements in a list
This may be subjective, I don't know: I have this problem, which I'm kind
hey all my question about how the developers makes their interface the buttons, slider,
I'm a computer science student finishing up my second semester of programming classes. I've

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.