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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:04:13+00:00 2026-05-23T05:04:13+00:00

What’s the algorithm that Linux uses to hash users’ passwords? How can I implement

  • 0

What’s the algorithm that Linux uses to hash users’ passwords? How can I implement that algorithm in PHP?

  • 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-23T05:04:14+00:00Added an answer on May 23, 2026 at 5:04 am

    You might need to know some background information on Linux password storage formats – especially on shadowed password configuration before you can actually implement your own.

    On Linux distributions using glibc2, the hash function has a ‘magic bit’ and salt prefixed to it.

    The magic bit starts off with ‘$x$’ and is used to determined the hash function that was used:

    • $1$ for MD5
    • $2$ for Blowfish,
    • $5$ for SHA-256 and
    • $6$ for SHA-512

    (Other unix systems like NetBSD might have different values for this).

    The magic bit then followed by 8 bits that constitutes the salt and optionally is terminated by another “$”. Between this and the next “$”, you will find the actual password hash.

    Almost all modern Linux systems these days do NOT store the passwords in the world-readable /etc/passwd. Instead the passwords are shadowed in /etc/shadow where only root is allowed read permission. If the shadowed password scheme in use, the /etc/passwd file shows a character such as ‘*’, or ‘x’ instead of the password.

    The format of a typical password in /etc/shadow would looks like this:

    $a:$b:$c:$e:$f:$g:$h:$i
    

    Where:

    $a: username

    $b: salt and hashed password (as explained above). If this is “NP” or “!” or null then it means that the account has no password. “LK” or “*” means the account is locked and the user will be unable to log-in. “!!” means that the password has expired

    $c: Days since epoch of last password change

    $d: Days until change allowed

    $e: Days before change required

    $f: Days warning for expiration

    $g: Days before account inactive

    $h: Days since epoch when account expires

    $i: Reserved for future use.

    An example of a shadowed password file could be found at: http://configuration.logfish.net/index.php/etc/shadow

    References:

    crypt(3) – Linux man page

    Why shadow your passwd file?

    Understanding Linux Password Hashes

    Shadow password on wikipedia

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.