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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:29:11+00:00 2026-06-06T05:29:11+00:00

Before i start, i know the MD5 is compromised (collision attack and speed of

  • 0

Before i start, i know the MD5 is compromised (collision attack and speed of hashing) and shouldn’t be used
to hash passwords, but just for the sake of it, bear with me.

My questions are:
How does the salt position when hashing with md5 affects the “quality”
or the “strength” of the hash?

Say i have the the following piece of code, which hashes a users
password using parts of his email address as salt:

<?php
    $email = 'user@emailservice.ex';
    $password = 'RandomPassWithChars';

    $segments = explode('@', $email);
    list($saltPart1, $saltPart2, $saltPart3) = $segments;

    $hash = md5($saltPart1.$password.$saltPart3.$saltPart2);
?>

Is that code going to slow down a brute force / dictionary / rainbow table
attack, than say:

<?php
    $password = 'RandomPass';
    $salt     = 'RandomSaltStoredInTheDatabase';
    $hash = md5($password, $salt);
?>

Is it worth trying to salt a password like in the first code or it yelds
the same result as the second code? Are there any benefits from that?
Does the first code delay cracking a list of passwords hashed that way than
the second way of doing it?

Which leads me to a second question:
Is it secure storing the salt in the database than obtaining a salt
from a user id (say the email address) ?
The way i see it, once an attacker has obtained a copy of the database
which also cantains the salts it makes his life a little easyer trying to crack the hashes. But if the salts are not stored, the attacker would also need the algorithm that creates the salts. PLEASE CORRECT ME IF I’M WRONG.

I hope i made my self clear. Thanks for any answers in advance.

  • 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-06T05:29:13+00:00Added an answer on June 6, 2026 at 5:29 am

    First question:

    The position of the salt has no impact on the security of a particular hash. A good hash function has perfect entropy, in that for every input bit that changes, each output bit has a 50% chance of changing.

    Any possible security benefit from a certain order would be entirely from the relative slowness of the algorithm used to concatenate the salt with the prospective password (e.g. if "password" . "salt" is slower than "salt" . "password", use the former). However, most programming languages don’t have that kind of performance ‘issue’.

    Second question:

    If the salt is stored explicitly in the database, the attacker will know the salt, and be able to launch a brute-force hashing attack. If the salt is unknown, a brute-force password attack can still be used (though this can easily be rendered ineffective by inserting delays between attempts). Also, the attacker may be able to reverse engineer the program and retrieve the hash field.

    As for the security of the hash, if the user has the same email and password two different places, this negates one of the benefits of a random salt, in that the same hash will be visible both places.

    Personally, I think the best method for hashing is to use:

    "password" . "salt" . "internalconstantvalue"
    

    This has the benefit of being simple, and no less secure than most other methods of security.

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

Sidebar

Related Questions

Before you start pointing me to duplicates just know that I have read nearly
I'm now developing a home project, but before I start, I need to know
Before I start just letting you know that I'm new to OOP programming so
Before I start know this: I am extremely new to Java and programming. How
Am using Mediainfo library in my C# project,before start invoking this dll,i just ran
Before I start let me just say that I'm really new to programming so
     Before we start I know a fair few people consider tests that hit the
before i start of with anything i know that jQuery and Ajax are the
What kind of things do I need to know before to start to use
I am new to programming. I know only Start debug before. Maybe start debug

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.