FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? [message #178389 is a reply to message #178386] Tue, 12 June 2012 19:26 Go to previous messageGo to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma:
Senior Member
On Tue, 12 Jun 2012 11:47:04 -0700 (PDT), kurtk(at)pobox(dot)com wrote:
>> No, hashes can never guaranteed to be unique.
>
> I opted to use
>
> md5(uniqid());
>
> to create a unique key.

Still not guaranteed to be unique. You've even got a defined 13-hexdigit
space thing what you're hashing. Which means as soon as you've got more
than 4,503,599,627,370,495 entries, you are GUARANTEED a collision. That
seems like a lot, but you're down to a one in a billion shot at a
collision when you've got a few million entries. And everybody knows,
that one in a billion changes turn up nine times in ten.

--
48. I will treat any beast which I control through magic or technology
with respect and kindness. Thus if the control is ever broken, it
will not immediately come after me for revenge.
--Peter Anspach's list of things to do as an Evil Overlord
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Best practice, (secure), to save session data?
Next Topic: runkit
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 09:57:50 GMT 2024

Total time taken to generate the page: 0.04229 seconds