Interface ( Functions : Objects : Constants ) : Examples : Structure : Support : Download : Copyright & License : History : Home | Version 0.1.0 |
XXX Note: The documentation is still far from complete !!!
This package provides a fast mechanism for generating universal identification strings (UIDs). The intent is to make these UIDs unique with high probability in order to serve as object or data set identifiers.
A typical use lies in generating session IDs. Other areas where unique IDs play an important role are RPC-implementations, ORBs, etc.
The mxUID package defines the following interfaces.
These functions are available.
uid may be a string or an ID instance. If code is given,
the id must have been created using that code.
The output has the same length as the input UID
string and should make it hard to forge valid UIDs
without knowledge of the key string.
Note that the output string is not a valid UID
string in itself, i.e. it most likely won't
verify().
To simplify and speed up handling UIDs the package
provides a fast constructor for building universal ID
strings (UIDs). These strings are normal Python strings
using a special predefined format.
The information encoded in the UID includes a timestamp, the
process ID, a host ID, an optional ID code (up to 100
characters) and a CRC value to assure the integrity of the
UID. This makes the UIDs unique with a high probability.
UID strings have a length of (32 + len(code)) bytes. If
no code is used, their length will always be 32 bytes.
Since UID strings are really only Python strings, they
behave in the same way, i.e. offer the same methods.
These constructors are available in the package:
code is optionally included in the UID. In order to
hide it using the
timestamp must be a ticks float (or an DateTime
instance) and defaults to the current time.
Functions
verify(uid, code='')
timestamp(uid)
mangle(uid, key)
demangle(euid, key)
UID String
UID String Constructors
UID(object=None, code='', timestamp=None)
mangle()
helper, the
code string should only contain lowercase HEX
characters (0-9, a-f). Non-HEX parts will not be
mangled.
Error
Here is a very simple one:
from mx.UID import * >>> uid = UID() >>> print uid 003bb9f7e7080c6d0c0001400601693a4c >>> verify(uid) 1 >>> verify(uid + '123') 0 >>> timestamp(uid) <DateTime object for '2001-10-02 19:22:47.00' at 81cc330>
More examples will eventually appear in the Examples
subdirectory of the package.
Entries enclosed in brackets are packages (i.e. they are
directories that include a __init__.py file). Ones
without brackets are just simple subdirectories that are not
accessible via
The package imports all symbols from the extension module,
so you only need to '
eGenix.com is providing commercial support for this
package. If you are interested in receiving information
about this service please see the eGenix.com
Support Conditions.
© 1997-2000, Copyright by Marc-André Lemburg;
All Rights Reserved. mailto: mal@lemburg.com
© 2000-2001, Copyright by eGenix.com Software GmbH,
Langenfeld, Germany; All Rights Reserved. mailto: info@egenix.com
This software is covered by the eGenix.com Public
License Agreement. The text of the license is also
included as file "LICENSE" in the package's main directory.
By downloading, copying, installing or otherwise using
the software, you agree to be bound by the terms and
conditions of the eGenix.com
Public License Agreement.
Things that still need to be done:
Changes from 0.1.0 to 0.2.0:
Version 0.1.0 was the intial release.
© 1998-2000, Copyright by Marc-André Lemburg;
All Rights Reserved. mailto: mal@lemburg.com
© 2000-2001, Copyright by eGenix.com Software GmbH;
All Rights Reserved. mailto: info@egenix.com
Package Structure
[UID]
Doc/
[mxUID]
UID.py
import
.
from mx import UID
' to start
working.
Support
What I'd like to hear from you...
Copyright & License
History & Future