eclipse / amlen

Message Broker for IoT/Mobile/Web. Mainly uses MQTT v3.x and v5. Aims to be easy to use, scalable and reliable
Eclipse Public License 2.0
48 stars 11 forks source link

[patch] node is overriding variant and sequence number in uuids #153

Closed jonquark closed 10 months ago

jonquark commented 10 months ago

https://www.uuidtools.com/uuid-versions-explained Explains that a type 1 uuid is of the form

LLLLLLLL-MMMM-VHHH-RSSS-NNNNNNNNNNNN Where: L = Low Time M = Mid Time V = Version (1) H = High Time R = Variant (in range 8-b inclusive as is starts 0b10......) S = Sequence number N = Node

NB Each Letter is a nibble (hex digit) not a byte

With the code as it stands in the high bits of the node are set, it is or'd in with the bytes that are used for the RSSS - i.e. corrupting the sequence number or even the variant.

This is a tiny fix that ensures the 4 nibbles (two bytes) that are reserved for the sequence number+variant are not or'd with the node.