Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Bigger number space #98

Closed
martinheidegger opened this issue Apr 8, 2022 · 2 comments
Closed

Bigger number space #98

martinheidegger opened this issue Apr 8, 2022 · 2 comments

Comments

@martinheidegger
Copy link

Thinking about how to increase the space to reduce collisions, see #23 (comment), I have been wondering if it wouldn't be possible to utilize two (a bit more out-there) concepts to increase the number space available and viability a little.

For one, as far I can see in rfc4144#4.1.3 the MSB 0 is not yet used and in this draft adds the version 0b1000. What if instead the language was changed to use MSB 0 as indicator for this version and MSB 1 ~ 2 for the var add MSB 3 to the random block and do the same for the 2 var bits.

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           unix_ts_ms                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          unix_ts_ms           | ver |         rand_a          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            rand_b                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            rand_c                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

This would increase the random space to 77 bits, not quite on the 80 bit level of ULID but it should still be significantly more practicable?!

@edo1
Copy link

edo1 commented Apr 8, 2022

Do you mean

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           unix_ts_ms                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          unix_ts_ms           |1 x x x|       rand_a          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |1 0 x|                      rand_b                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            rand_b                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

where x is used as a random/counter?

P. S. There was a similar idea to use 0b111 variant with no version filed: #26

@martinheidegger
Copy link
Author

Thank you, it's indeed a duplicate of the conversation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants