Short UID Generator
Short, URL-safe unique identifier generator.
Overview
VCollab applications frequently need short, unique identifiers for temporary file names, directory names, session IDs, or other scenarios where brief, collision-resistant strings are needed.
The vcti-short-uid package provides ShortUID -- a generator that
produces URL-safe identifiers by hashing a combination of entropy,
salt, timestamp, and randomness. The result is truncated to a
configurable length (default: 8 characters).
This package has zero external dependencies.
Installation
pip install vcti-short-uid
In requirements.txt
vcti-short-uid>=1.3.0
In pyproject.toml dependencies
dependencies = [
"vcti-short-uid>=1.3.0",
]
Quick Start
from vcti.shortuid import ShortUID
# One-shot generation (no instance needed)
uid = ShortUID.quick() # e.g. "a3Bx9kLm"
# Reusable generator with entropy seed
gen = ShortUID(entropy="my-app")
uid1 = gen.generate() # 8-char default
uid2 = gen.generate(salt="report.pdf") # salt adds context
# Custom length
long_uid = ShortUID.quick(length=16) # 16-char ID
Public API
ShortUID(entropy=None, length=8)
Create a generator instance.
| Parameter | Type | Default | Description |
|---|---|---|---|
entropy |
str | None |
None |
Optional base entropy seed |
length |
int |
8 |
Number of characters in generated IDs (range: 1--43) |
Raises:
TypeError-- iflengthis not an integer, orentropyis not a string/None.ValueError-- iflengthis outside the range[1, 43].
ShortUID.generate(salt=None) -> str
Generate a short, URL-safe unique identifier.
| Parameter | Type | Default | Description |
|---|---|---|---|
salt |
str | None |
None |
Additional context string |
Raises:
TypeError-- ifsaltis not a string/None.
ShortUID.quick(length=8) -> str (classmethod)
Convenience one-liner -- creates a temporary instance and generates one ID.
repr(ShortUID(...))
Returns a string like ShortUID(entropy='my-app', length=8) for debugging.
Dependencies
None. Standard library only (base64, hashlib, secrets, time).
Documentation
| If you want to… | Read |
|---|---|
| Get started using the package | Quick Start above |
| Understand the architecture and design decisions | docs/design.md |
| Navigate and understand the source | docs/source-guide.md |
| Look up a specific function or type | docs/api.md |
| See the release history | CHANGELOG.md |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcti_short_uid-1.3.0.tar.gz.
File metadata
- Download URL: vcti_short_uid-1.3.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e149641ea45e262cbc6d5546277b42b61eb1c811a85199159e9e897b2380338c
|
|
| MD5 |
d59667da0a236522107c54996e9d7b54
|
|
| BLAKE2b-256 |
3b2318a1a07692bb2ea4669c4593aaabdd364c52415a9219bc9dfc74f468c835
|
Provenance
The following attestation bundles were made for vcti_short_uid-1.3.0.tar.gz:
Publisher:
release.yml on vcollab/vcti-python-short-uid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_short_uid-1.3.0.tar.gz -
Subject digest:
e149641ea45e262cbc6d5546277b42b61eb1c811a85199159e9e897b2380338c - Sigstore transparency entry: 2200961080
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-short-uid@72ffea6dfc7b78e1cc48e7730114dad81ca2008b -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@72ffea6dfc7b78e1cc48e7730114dad81ca2008b -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_short_uid-1.3.0-py3-none-any.whl.
File metadata
- Download URL: vcti_short_uid-1.3.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b727b6475129232480fb7ae605ccf0c72516c30183e56f796e70832e6e665a0
|
|
| MD5 |
72b2253c8c9229db0ce738539f770f73
|
|
| BLAKE2b-256 |
4812352ed7e4e63eb9c83614c198b414a61b99c07a65e600e66a2f243b272415
|
Provenance
The following attestation bundles were made for vcti_short_uid-1.3.0-py3-none-any.whl:
Publisher:
release.yml on vcollab/vcti-python-short-uid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_short_uid-1.3.0-py3-none-any.whl -
Subject digest:
6b727b6475129232480fb7ae605ccf0c72516c30183e56f796e70832e6e665a0 - Sigstore transparency entry: 2200961206
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-short-uid@72ffea6dfc7b78e1cc48e7730114dad81ca2008b -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@72ffea6dfc7b78e1cc48e7730114dad81ca2008b -
Trigger Event:
push
-
Statement type: