Socket
Socket
Sign inDemoInstall

cuid

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuid

Fast, scalable unique ID generation


Maintainers
2

cuid.py

Implementation of https://github.com/ericelliott/cuid in Python.

A cuid is a portable and sequentially-ordered unique identifier designed for horizontal scalability and speed -- this version is ported from the reference implementation in Javascript.

NOTE: Particularly if you have security concerns, the cuid standard has been deprecated in favor of cuid2!

Tested on CPython 2.7, 3.6-3.11 as well as PyPy & PyPy3.

Rough benchmarks on my machine (i7-8750H CPU @ 2.20GHz) using setup.py bench (which times the creation of 1 million cuids):

Versionns / cuid
CPython 3.7.36095.257
CPython 3.6.86846.050
CPython 3.5.66604.012
CPython 2.7.166913.681
PyPy 7.1.1 (Python 2.7.13)326.344
PyPy3 7.1.1 (Python 3.6.1)562.673

(Note that timing the creation of fewer IDs changes the way PyPy runs the code, because of JIT warmup -- obviously creating this many IDs takes advantage of the warmed JIT)

For now, this has no dependencies outside the standard library -- in time this may change, to provide better random numbers and / or performance.

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc