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

  • Home
  • SEARCH
  • 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 3312394
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:59:25+00:00 2026-05-17T21:59:25+00:00

This question isn’t really a problem looking for a solution, it’s more just a

  • 0

This question isn’t really a problem looking for a solution, it’s more just a matter of simple curiosity. The PHP uniqid function has a more entropy flag, to make the output “more unique”. This got me wondering, just how likely is it for this function to produce the same result more than once when more_entropy is true, versus when it isn’t. In other words, how unique is uniqid when more_entropy is enabled, versus when it is disabled? Are there any drawbacks to having more_entropy enabled all the time?

  • 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-17T21:59:25+00:00Added an answer on May 17, 2026 at 9:59 pm

    Update, March 2014:

    Firstly, it is important to note that uniqid is a bit of a misnomer as it doesnt guarantee a unique ID.

    Per the PHP documentation:

    WARNING!

    This function does not create random nor unpredictable string. This
    function must not be used for security purposes. Use cryptographically
    secure random function/generator and cryptographically secure hash
    functions to create unpredictable secure ID.

    And

    This function does not generate cryptographically secure tokens, in
    fact without being passed any additional parameters the return value
    is little different from microtime(). If you need to generate
    cryptographically secure tokens use openssl_random_pseudo_bytes().


    Setting more-entropy to true generates a more unique value, however the execution time is longer (though to a tiny degree), according to the docs:

    If set to TRUE, uniqid() will add additional entropy (using the
    combined linear congruential generator) at the end of the return
    value, which increases the likelihood that the result will be unique.

    Note the line increases the likelihood that the result will be unique and not that is will guarantee uniqueness.

    You can ‘endlessly’ strive for uniqueness, up to a point, and enhance using any number of encryption routines, adding salts and the like- it depends on the purpose.

    I’d recommend looking at the comments on the main PHP topic, notably:

    http://www.php.net/manual/en/function.uniqid.php#96898

    http://www.php.net/manual/en/function.uniqid.php#96549

    http://www.php.net/manual/en/function.uniqid.php#95001

    What I’d recommend is working out why you need uniqueness, is it for security (i.e. to add to an encryption/scrambling routine)? Also, How unique does it need to be? Finally, look at the speed consideration. Suitability will change with the underlying considerations.

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

Sidebar

Related Questions

This question isn't really for any specific technology but more of general developer question.
Important: This question isn't actually really an ASP.NET question. Anyone who knows anything about
This question isn't meant as flame-bait! As it might be apparent, I've been looking
Unfortunately, the answer to this question isn't quite as simple as it sounds... but
This question isn't about unit-testing. And it is for a desktop product. This is
I know this question isn't directly programming related, but since I want to be
I apologise in advance if this question isn't very specific. Would it be possible
I'm relatively new to web application programming so I hope this question isn't too
This question is related to the question posted here: Why isn't my custom WCF
I haven't found an answer to this particular question; perhaps there isn't one. But

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.