Code Monkey home page Code Monkey logo

kuid's Introduction

kuid

Travis-CI

Collision-resistant ids optimized for horizontal scaling and binary search lookup performance.

Currently available for Node, browsers, Ruby, .Net, Go, PHP and Elixir (see ports below -- more ports are welcome).

kuid() returns a short random string with some collision-busting measures. Safe to use as HTML element ID's, and unique server-side record lookups.

Example

ESM:

import kuid from 'kuid';

kuid.initPrefix('yo')
console.log( kuid() );

// yojld2cjxh0000qzrmn831i7rn

Node style:

var kuid = require('kuid');
console.log( kuid() );

// kjld2cyuq0000t3rmniod1foy

Installing

$ npm install --save kuid

Broken down

** c - h72gsb32 - 0000 - udoc - l363eofy **

The groups, in order, are:

  • 'prefix' - identifies this as a kuid, and allows you to use it in html entity ids.
  • Timestamp
  • Counter - a single process might generate the same random string. The weaker the pseudo-random source, the higher the probability. That problem gets worse as processors get faster. The counter will roll over if the value gets too big.
  • Client fingerprint
  • Random (using cryptographically secure libraries where available).

kuid's People

Contributors

0xdaksh avatar crabmusket avatar duailibe avatar erbridge avatar ericelliott avatar ericwlange avatar flet avatar gitter-badger avatar gjcoombes avatar gmaclennan avatar hden avatar jhermsmeier avatar kennylavender avatar marcoonroad avatar markherhold avatar matthiasg avatar max-mapper avatar maxwellgerber avatar moonpyk avatar nicmitchell avatar paambaati avatar pieterjandesmedt avatar scop avatar sorenbs avatar therealklanni avatar wbinnssmith avatar wclr avatar zakame avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.