ANN: uid.py 1.0.2 -- Configurable unique ID generation

E

Erik Max Francis

Summary

Configurable unique ID generation.


Overview

Provided is an implementation of a "unique" ID (UID) generator in
Python. The implementation does not follow UUID or GUID
standards, but rather uses available system, host, user, shell
environment, process, and other ephemeral information fed into a
hasher (by default MD5) to generate the UID.

The system is designed to be used both as a standalone application
and as a module. The data used to be fed into the hash, as well
as the hashing mechanism itself, can be overridden both through
the command line and programmatically by importing the module.


Getting the software

The current version of uid is 1.0.2.

The latest version of the software is available in a tarball here:
http://www.alcyone.com/software/uid/uid-latest.tar.gz.

The official URL for this Web site is
http://www.alcyone.com/software/uid/.


Requirements

uid.py is intended to be used under UNIX and UNIX-like systems in
Python 2.x.


License

This code is released under the GPL.
 
I

Irmen de Jong

Erik said:
Summary

Configurable unique ID generation.
[...]

Requirements

uid.py is intended to be used under UNIX and UNIX-like systems in
Python 2.x.

It's not too hard to make it work on win32, although you'd probably
best off to use import pywintypes; return pywintypes.CreateGuid()
on win32...

158c158,159
< self.set('uname', string.join(os.uname(), ':'))
---
> if sys.platform!="win32":
> self.set('uname', string.join(os.uname(), ':'))
165,169c166,173
< self.set('login', os.getlogin())
< self.set('uid', os.getuid())
< self.set('gid', os.getgid())
< self.set('euid', os.geteuid())
< self.set('egid', os.getegid())
---
> if sys.platform=="win32":
> self.set('login', os.environ["USERNAME"])
> else:
> self.set('login', os.getlogin())
> self.set('uid', os.getuid())
> self.set('gid', os.getgid())
> self.set('euid', os.geteuid())
> self.set('egid', os.getegid())
177c181,182
< self.set('termid', os.ctermid())
---
> if sys.platform!="win32":
> self.set('termid', os.ctermid())
183,184c188,190
< self.set('pgrp', os.getpgrp())
< self.set('ppid', os.getppid())
---
> if sys.platform!="win32":
> self.set('pgrp', os.getpgrp())
> self.set('ppid', os.getppid())


--Irmen
 
T

Tim Roberts

Erik Max Francis said:
Summary

Configurable unique ID generation.

Overview

Provided is an implementation of a "unique" ID (UID) generator in
Python. The implementation does not follow UUID or GUID
standards, ...

Maybe I'm being ridiculous, but intuitively, this makes me uncomfortable.
If one has a "unique ID" generator, isn't it likely that any change to its
configuration is only going to serve to reduce the "uniqueness"?

UUIDs and GUIDs are standardized for a reason.
 
E

Erik Max Francis

Tim said:
Maybe I'm being ridiculous, but intuitively, this makes me
uncomfortable.
If one has a "unique ID" generator, isn't it likely that any change to
its
configuration is only going to serve to reduce the "uniqueness"?

Only if the chances of a collision are increased. Since there are no
known MD5 (much less SHA) hash collisions, that does not seem worth
worrying about.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,199
Messages
2,571,045
Members
47,644
Latest member
EarnestK61

Latest Threads

Top