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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:14:18+00:00 2026-05-24T09:14:18+00:00

Revising my question so as not to rustle the natives. It seems there are

  • 0

Revising my “question” so as not to rustle the natives.

It seems there are so many resources around the internet these days (SO included) that finding “an” answer to a question may be easy, but how to tell if that answer is valid or even up to date?

One area in particular and one that gets asked a lot is how to deal with hashing and encryption properly with PHP for preparation in database storage. One common answer on SO always seems to be “Have you visited php.net yet?”. While I understand this typically comes to a question in which somebody asks the simplest of questions, I have started to find some of the descriptions seem to conflict and more importantly, the user examples are outdated (a lot from 2008-2009).

For example: when seeking why and how to use password hashing: http://www.php.net/manual/en/faq.passwords.php#faq.passwords.fasthash

In summary, I learn that sha1 and md5 are fast and computationally efficient methods of hasing, they are no longer suitable for password hashing. The suggested method is to use the crypt() function.

When learning more about crypt() and in particular blowfish hashing, the rules stated on the page are as follows:

http://www.php.net/manual/en/function.crypt.php

  • start my salt with $2a$
  • continue with two numeric values (user below has stated the significance of this whereas php.net does not)
  • follow with a $
  • enter 22 alpha-numeric characters

Further reading gives an example of:

<?php

    if (CRYPT_BLOWFISH == 1) {
        echo 'Blowfish:     ' . crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$') . "\n";

    }
?>

It seems the example on the same page does not follow the rules it just told us to use (26 characters after “$2a$07$”.

The return has is:

Blowfish:
$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi

essentially, the string itself does in fact get altered but nearly my entire SALT value (the first 22 characters mentioned above) is sitting wide open. Wouldn’t this make it somewhat simpler to determine what my actual string was?

More importantly, this is only one example but ultimately, how heavily should resources such as PHP.net be relied upon?

As my friend Mugatu once said “I feel like I’m taking crazy pills”.

Note: the pages mentioned above were edited since my original posting so I cannot guarantee things have not changed since my original question and examples provided.

  • 1 1 Answer
  • 3 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-24T09:14:18+00:00Added an answer on May 24, 2026 at 9:14 am

    You’re right, the internet (being a wonderful and terrible place) is FULL of contradictory information on how you should do this. I have my own opinions (I like EksBlowfish for one-way password hashing) which I outline in this shameless, self-serving blog plug.

    One important note, in case you don’t follow that link. The two numbers that follow $2a$ are NOT RANDOM. They are the Log-Base-2 of the number of rounds of EksBlowfish to run on the string; basically, every time you increment the number by 1 (e.g., $2a$07$ to $2a$08$), you double the amount of time it takes to calculate the hash.

    This is by design — it allows EksBlowfish to be extremely computationally expensive, and when hardware scales up (Moore’s law) you can bog it back down and make it expensive again.

    As a good friend of mine put it, the only real way to try to fend off a good cracker is to waste their time. Again, check out this shameless, self-serving blog plug if you want more information on (a) EksBlowfish and (b) why you should use it; if you want, skip to the end of the article for links to things written by people who are significantly smarter than I am.

    Edit

    As for why PHP includes direct implementations of things like SHA-1 and MD5 is because PHP wasn’t invented yesterday, it’s been around (in various forms) for 20 years. MD5 used to be considered secure. Things change.

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

Sidebar

Related Questions

I'm revising code I did not write that uses JavaMail, and having a little
I'm revising my question from a few days ago. Rewrote my query. Can someone
I am revising for a Database course and I have the following question from
I'm reviving this question, and making it more specific: Is there a .NET framework
I'm am currently revising a plugin architecture so that it utilizes AppDomains. The main
I am revising one of our in-house RPMs that adds to the nagios package.
Totally revising this question, since I fixed the first issue but have ran into
I'm revising for a introduction to programming exam and I have a question which
Okay, I've realized that I really have asked way too many questions without contributing
Revising the bootstrap-modal jquery plugin from Twitter's bootstrap I see that they use CSS

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.