[Zope-dev] Globally unique id's in Zope in a new way

Jason Spisak 444@hiretechs.com
Fri, 10 Mar 2000 21:22:15 GMT


Thanks.  I like the fact that it is unique across multiple servers.  I
wonder If their is a way to get a truely unique one generated by using the
MAC address with time?

Sam Gendler writes:

> I just generated something like this for a product, in python.  In order
> to guarantee uniqueness across a cluster of servers, I use the last
> octet of the ip address (assuming the cluster is all on the same
> subnet), the time, a call to randint(1,10000).  If you really want to
> make things interesting, run that through the sha algorithm, and you get
> a nice 160 bit key rendered in hex.
> 
> In obfuscated code, it looks like:
> 
> sha(split(gethostbyname(gethostname()),'.')[3]+str(int(time.time()-900000000))+str(randint(1,1000))).hexdigest()
> 
> but you would do well to make it multiple lines of code... ;-)
> 
> --sam
> 
> 
> -- 
> --------------------------
> Sam Gendler
> CTO, Impossible, Inc.
> 1222 State St. Suite 250
> Santa Barbara, CA. 93101
> p: 805-560-0508
> f: 805-560-0608
> c: 805-689-1191
> e: sgendler@impossible.com


Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.