You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

kuid

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kuid

Library to shorten UUIDs

0.2.1
pipPyPI
Maintainers
1

kuid

A universally unique identifier, is essentially a shorter version of a UUID and is commonly used to identify records in various applications.

Rationale

When writing a web application, often times we would like to keep the URLs short.

http://localhost/posts/5eAU5M3OyqyuX93bJHopJV

This certainly gives a more concise look than the following.

http://localhost/posts/b9926647-86a7-4f31-9c38-f7cf711bf865

Installation

kuid can be installed via pypi.

pip install kuid

Usuage

The following section describes a basic usage of base62.

>>> import uuid
>>> import kuid
>>> 
>>> kuid.encode(uuid.UUID('b9926647-86a7-4f31-9c38-f7cf711bf865'))
'5eAU5M3OyqyuX93bJHopJV'
>>> 
>>> kuid.decode('5eAU5M3OyqyuX93bJHopJV')
UUID('b9926647-86a7-4f31-9c38-f7cf711bf865')

It also has wrappers around basic uuid functions

>>> import kuid
>>> 
>>> kuid.kuid1()
'47ZU06aw8pUWT5BzmVHsST'
>>> kuid.kuid4()
'60fq4TTss8KYXlT2yJy3AQ'

Credits

  • https://dev.to/sonus21/kuid-compressed-universally-unique-identifier-384i
  • https://github.com/suminb/base62

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.