-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.txt
24 lines (18 loc) · 859 Bytes
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Tiny Unique Identifiers
Tiny Unique Identifiers is a module for generating short ids similar to what's
seen in popular url shorteners. Typically, with short ids a uniqueness check is
needed to ensure the id does not exist yet. I wasn't happy with this approach,
so instead I thought to use something already unique (say a primary key or
just a counter) and transform it such that at least looks random. Tuid uses a
hill cipher to do this. With a proper key, the hill cipher can be reversed, so
it still guarantees the uniqueness.
NOTE: the current cipher used is not suitable for cryptographic applications
Dependencies: Numpy
Basic Usage:
Intialize the module with:
tuid_init(seed, length, alphabet)
seed - random number initialization
length - length of each id
alphabet - possible output characters
then start generating ids:
tuid(index)