Skip to main content

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 -- if length is not an integer, or entropy is not a string/None.
  • ValueError -- if length is 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 -- if salt is 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

vcti_short_uid-1.3.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcti_short_uid-1.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

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

Hashes for vcti_short_uid-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e149641ea45e262cbc6d5546277b42b61eb1c811a85199159e9e897b2380338c
MD5 d59667da0a236522107c54996e9d7b54
BLAKE2b-256 3b2318a1a07692bb2ea4669c4593aaabdd364c52415a9219bc9dfc74f468c835

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for vcti_short_uid-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b727b6475129232480fb7ae605ccf0c72516c30183e56f796e70832e6e665a0
MD5 72b2253c8c9229db0ce738539f770f73
BLAKE2b-256 4812352ed7e4e63eb9c83614c198b414a61b99c07a65e600e66a2f243b272415

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.0

2 files

This release

1.3.0 This release

2 files

1.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page