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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:43:49+00:00 2026-06-13T09:43:49+00:00

I’m designing a REST API and I have some problems in terms of security

  • 0

I’m designing a REST API and I have some problems in terms of security for authenticating the user.
For authentication I don’t want the password to be send across the network in plain text.

To bypass this problem I could send a SHA-256 hash of the password (with the username as salt), so the password is never sent in plain text. In my database I will be storing the following hashes: SHA256(password + salt) and I’ll compare if both of the hashes match.

The problem with this option is that I’ll have a hash computed with a fast hash algorithm and the salt is not random.

In security the best practice is to use a slow signature algorithm, with a random salt (like bcrypt).

The slow algorithm is not a problem, i could use bcrypt on the client side, but for the salt i don’t know what to do:

  • Bcrypt need a salt with a defined size so i can’t put the username
  • If i’m using a random salt, how the client will know the value of this salt before computing the password’s hash?

So i can see 3 options, but none are sastisfying:

  • I send the password in plain text (I’m using SSL) and i store bcrypt in the db => still vulnerable to man in the middle
  • I use SHA256 and send the hash where the salt is the username (still using SSL) => the hash in the db are less secure
  • I use bcrypt and I have a two step process: i ask for the saltfor a given user and then send the hash of this user (still using ssl) => by trying to log in with an other username i can obtain his salt, not awesome

Is anybody has a better solution or some advices?

  • 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-13T09:43:50+00:00Added an answer on June 13, 2026 at 9:43 am

    There a couple of advantages to the approach of hashing on the client side. One of them is the server never gets the real passwords, so if the server is compromised in any way, it still won’t get the real password. The other one is, it can lighten the load on the server side if you’re planning to use slow hashing.

    However, hashing passwords is designed to protect you in case the database is breached and hashes are stolen. This means if someone gets a hold of the hashed passwords, they could still impersonate users by sending the hash. The implication is, even if you hash on the client side, you still need to re-hash on the server.

    The other potential downside is that this could alienate part of your userbase that doesn’t have JavaScript enabled.


    To address your points:

    Bcrypt need a salt with a defined size so i can’t put the username

    Don’t use the username as a salt. Salts should be unique, and a username (and derivations thereof) is certainly not unique. By unique I don’t mean just unique to the server, but unique everywhere. Use a cryptographic nonce instead.

    If i’m using a random salt, how the client will know the value of this salt before computing the password’s hash?

    Just have the server send the salt (nonce) beforehand. You could do this on the client as well, but the Javascript doesn’t have a CSPRNG as far as I know, and you’d still need to send the nonce back to the server.

    I send the password in plain text (I’m using SSL) and i store bcrypt in the db => still vulnerable to man in the middle

    SSL was designed to prevent man in the middle attacks. Unless it’s broken somehow, that’s not going to be a problem.

    I use SHA256 and send the hash where the salt is the username (still using SSL) => the hash in the db are less secure

    Don’t use username as a salt. And like I said before, you have to hash on the server side regardless of whether or not you did it on the client side.

    I use bcrypt and I have a two step process: i ask for the salt for a given user and then send the hash of this user (still using ssl) => by trying to log in with an other username i can obtain his salt, not awesome

    Not awesome indeed.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.