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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:39:30+00:00 2026-05-19T14:39:30+00:00

After a few days researching on hashing, generating random numbers or unique keys, I

  • 0

After a few days researching on hashing, generating random numbers or unique keys, I am a bit confusing now.

I have one last thing that I want to get it right which is the user key. I want to store an unique key for each member/ user who registers at my website. So this key must be unique and not duplicate. I am thinking to use the user email and hash it with timedate or something…

Then I wonder which is the best way to create such a key –

Can I use hash_hmac() to do this for me?

I have a couple of things don’t understand about hash_hmac() though – as in this example from the php.net hash_hmac('ripemd160', 'The quick brown fox jumped over the lazy dog.', 'secret');

So what is ‘secret’ – can I put anything different instead, like a timedate?
I assume that I can replace ‘The quick brown fox jumped over the lazy dog.’ with the email address?

or maybe I can use Portable PHP password hashing framework to do this?

the only thing is that it produces ., $, and / which I need to remove them otherwise I will get errors when I request the key from the URL.

so I might do this –

$hash = $phpass -> HashPassword('me@example.com'.$timedate)
$key = preg_replace("/[^a-zA-Z0-9]+/", "", $hash);

Please let me know if you have any better suggestions.

  • 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-19T14:39:31+00:00Added an answer on May 19, 2026 at 2:39 pm

    I have one last thing that I want to
    get it right which is the user key. I
    want to store an unique key for each
    member/ user who registers at my
    website. So this key must be unique
    and not duplicate. I am thinking to
    use the user email and hash it with
    timedate or something

    • I would just let your database handle this for you using autoincrement
    • You could also use uniqid for this: md5(uniqid(rand(), TRUE));

    index.php:

    for ($i=0;$i<10;$i++) {
        echo md5(uniqid(rand(), TRUE)) . "\n";
    }
    

    output:

    php index.php 
    ba0d9aad1ff0ceadf4b25f101099b91e
    b5a6db5e174b426061d3d3835a6fcaea
    54be6d3a03e0590917ed20b097442e3a
    6e208a61eae8cfd102d4a41decf0f64e
    2cafac5402815af87e8299e5e67016bd
    95e839097a566471c70fe357e5a101d2
    c6908532bda6f926debdda754b02f931
    aac7adf999dd4dd009f208b176ea90d0
    1ed7779229e57b05adc088b375582cfb
    e016a684564d5cdb89201ebab1038609
    

    They are all unique and you can just use them. You should NOT have to do anything else?

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

Sidebar

Related Questions

No luck after a few days of researching this one. Should be simple, but
I have been wrestling with this for a few days and after tons of
I returned to one of my ipad projects after few days and strangest thing
Recently I have started using Lucene. However, after few days I've spotted that queries
I need to implement Android application which will be expired after few days or
After read a lot about ball physics, watch some examples and few days of
After a few harsh lessons I now always use OrdinalIgnoreCase when comparing Strings in
My code used to work, and after a few days of not touching it
What I'm trying to do seems very simple, but after a few days of
I posted about this before to a degree, but after a few days of

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.