Skip to content

Commit

Permalink
Using reproducible UUID namespace
Browse files Browse the repository at this point in the history
This commit updates the creation of UUID5 (SHA-1 hash) from using
the UUID5 of their parent as the namespace to a UUID5 namespace
derived from the object identifier 'vehicle_signal_specification':

> uuid.uuid5(uuid.NAMESPACE_OID, 'vehicle_signal_specification')
> UUID('4635ee41-2db8-5e71-94e0-9ad0f157522c')

This means that a UUID5 for any node in the VSS tree can always
be computed with:

> uuid.uuid5(UUID('4635ee41-2db8-5e71-94e0-9ad0f157522c'), 'Vehicle')
> UUID('ccc825f9-4139-544d-bb5f-4bfd033bece6')

This fixes the criticism that the previous signal ID, which was simply
a numbering, already had and that was carried over to the UUID scheme
that with any new creating of the ID database the IDs would change
unless the database was used as a lookup table (in that case the ID
would simply be read from the database).

This carried over to the UUID-based database because the root UUID
(the one for the first node called 'vehicle') was created using a
UUID1 which is based on hostid, sequence number and time. Furthermore,
the previous UUID creation used the parent node's UUID as the namespace,
hence nodes with different parents would use a different namespace (and
all nodes with 'vehicle' as parent would use the UUID1 for 'vehicle' as
their namespace).

Technically, with this change the ID database becomes somewhat obsolete
as a lookup table to create UUIDs as they always can be reccomputed as
shown above. However, the database still has its place as a reverse lookup
table since UUIDs are of course hashes and hash functions are not inverse.
  • Loading branch information
rstreif authored and danielwilms committed Feb 16, 2020
1 parent 54e907d commit 317645b
Show file tree
Hide file tree
Showing 2 changed files with 1,594 additions and 1,592 deletions.

0 comments on commit 317645b

Please sign in to comment.