[Molecularmechanics] Recycling CML

Eugen Leitl molecularmechanics@tddft.org
Wed, 12 Nov 2003 13:26:11 +0100


--whpHMr7UwS4k4x4q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 04, 2003 at 09:21:50PM +0000, Peter Murray-Rust wrote:

> This is a tricky problem with no clear solution. The simplest answer is=
=20
> that if you use an id attribute of XML type ID then they must be. But how=
=20
> is this to be achieved? There are two approaches:
> - use an algorithm that generates uniqueness planetwide. This is very=20
> difficult and usually relies on machine IDs, system time and possible=20
> geographical location. The IDs cannot be hashed, so Ids of ca 80 characte=
rs=20
> are common. Not recommended

Generating useful UIDs is difficult, but for most applications you can seed
a cryptographic pseudorandom number generator (PRNG) from a pool of entropy
(on decent UNIX systems that's /dev/urandom) and just use an XML-sane
representation of an SHA-1 hash.=20

If you look at the processing rate (MBytes/s):

SHA-1   48.462
SHA-256 24.746
SHA-512  8.246

then the rate if UID generation should not be a bottleneck in most cases.

If used properly (see above), collision of 160-bit values are arbitrarily
improbable. For extra paranoia, one can always use SHA-512.


-- Eugen* Leitl <a href=3D"http://leitl.org">leitl</a>
______________________________________________________________
ICBM: 48.07078, 11.61144 http://www.leitl.org
8B29F6BE: 099D 78BA 2FD3 B014 B08A  7779 75B0 2443 8B29 F6BE

--whpHMr7UwS4k4x4q
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/sibidbAkQ4sp9r4RAopxAJwPxxGzBx934BqQPjO8uyrdif+elgCfWGji
VIF1hkygreAQGbNrscWTq9I=
=itfI
-----END PGP SIGNATURE-----

--whpHMr7UwS4k4x4q--