You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,14 +25,28 @@ therefore up to the users of this crate to choose an ID
25
25
appropriately. Therefore, this library will continue to support v1
26
26
CUIDs for the foreseeable future. See the original authors' position in more detail [here](https://github.com/paralleldrive/cuid2?tab=readme-ov-file#note-on-k-sortablesequentialmonotonically-increasing-ids).
27
27
28
-
If you only need `cuid2`, you can use the `cuid2` crate: [cuid2 crate](https://docs.rs/cuid2/latest/cuid2/).
28
+
By default, both `cuid1` and `cuid2` algorithms are provided. If you
29
+
only need one, you can disable default features and select just the one
30
+
you need, for example to only include v2 CUIDs:
31
+
32
+
```toml
33
+
cuid = { version = "2.0.0", default-features = false, features = ["v2"] }
34
+
```
35
+
36
+
You can also use the [cuid1] or [cuid2] crates independently.
37
+
38
+
## Upgrading to version 2.0
39
+
40
+
Functions like `cuid()` have been removed in favor of version-specific
41
+
functions, like `cuid1()`. You can either update the function calls or
42
+
replace your use of the cuid crate with the [cuid1] or [cuid2] crate.
29
43
30
44
## Installation
31
45
32
46
In cargo.toml
33
47
34
48
```toml
35
-
cuid = "1.4.0"
49
+
cuid = "2.0.0"
36
50
```
37
51
38
52
Or install the binary:
@@ -59,18 +73,18 @@ fn main() -> () {
59
73
// the length, counter function, and fingerprinter (note that
60
74
// these are const functions, so you can create a static
Cuids are "Collision-resistant ids optimized for horizontal scaling and
8
8
binary search lookup performance."
@@ -14,16 +14,21 @@ This library provides the `cuid1` algorithm:
14
14
-`cuid1` is a k-sortable ID that is extremely fast to generate with
15
15
very good randomness properties
16
16
17
+
Note that the [cuid] crate is also available, and provides access to
18
+
both the `cuid1` and `cuid2` algorithms.
19
+
17
20
**NOTE:** It is the position of the original authors of CUID that
18
21
`cuid1` is "insecure" due to its being k-sortable and potentially
19
22
exposing information about generation order and/or time of
20
23
generation. It is my position that these properties apply to a number
21
24
of very good ID-generating algorithms (such as UUIDv7), and it is
22
25
therefore up to the users of this crate to choose an ID
23
26
appropriately. Therefore, this library will continue to support v1
24
-
CUIDs for the foreseeable future. See the original authors' position in more detail [here](https://github.com/paralleldrive/cuid2?tab=readme-ov-file#note-on-k-sortablesequentialmonotonically-increasing-ids).
27
+
CUIDs for the foreseeable future. See the original authors' position
28
+
in more detail [here](https://github.com/paralleldrive/cuid2?tab=readme-ov-file#note-on-k-sortablesequentialmonotonically-increasing-ids).
25
29
26
-
If you only need `cuid2`, you can use the `cuid2` crate: [cuid2 crate](https://docs.rs/cuid2/latest/cuid2/).
30
+
If you would like an algorithm that is not k-sortable, you can use the
0 commit comments