A tiny isomorphic fast function for generating a cryptographically random hex string.

Overview

ZeptoID

A tiny isomorphic fast function for generating a cryptographically random hex string.

Accoding to this calculator one would have to generate ids at a rate of 1 billion per second for ~83 years to have a 1% probability of finding a collision.

Comparison

Compared to nanoid there are the following differences:

  • zeptoid is 50% faster.
  • zeptoid has a ~5x bigger space of possible unique strings that could be generated.
  • zeptoid is not customizable in any way, it will always simply output a 32-characters hex string.
  • zeptoid uses only the 16-characters of the hexadecimal alphabet, which makes the ids more human-friendly.

Install

npm install --save zeptoid

Usage

import zeptoid, {is} from 'zeptoid';

// Generate ids

zeptoid (); // => 'aceee829076f33f6626a93ad1fcca776'
zeptoid (); // => '39a07eda327e5b52f903d06303ca97be'
zeptoid (); // => '0c1a4d3f273505565a380022fda07edd'

// Check if a string is a zeptoid or not

is ( zeptoid () ); // => true
is ( 'something' ); // => false

License

MIT © Fabio Spampinato

You might also like...

CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files.

convert-to-oklch CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files. npx convert-to-oklch ./src/**/*

Dec 20, 2022

The time represented as hex color values

A clock that represents the time as hex color values I saw a project a little while ago, where I discovered that the time (in format 00:00:00) works p

Aug 16, 2022

A NodeJS package to convert any RGB color to HEX color or viceversa. Also supports HSL conversion.

Unhex 🎨 A NodeJS package to convert any RGB color to HEX, HSL color or viceversa. Example div { color: #fff; background-color: #0070f3; } After r

Oct 1, 2022

A tiny (108 bytes), secure, URL-friendly, unique string ID generator for JavaScript

A tiny (108 bytes), secure, URL-friendly, unique string ID generator for JavaScript

Nano ID English | Русский | 简体中文 | Bahasa Indonesia A tiny, secure, URL-friendly, unique string ID generator for JavaScript. “An amazing level of sens

Jan 8, 2023

Competidaily Generator lambda function to retrieve a random theme from our database.

Competidaily Generator backend - GET RANDOM THEME This repo contains the GET requisition used as a lambda function to retrieve a random theme from the

Dec 17, 2022

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil 👋 A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Jun 20, 2022

Tries to execute sync/async function, returns a specified default value if the function throws

good-try Tries to execute sync/async function, returns a specified default value if the function throws. Why Why not nice-try with it's 70+ million do

Dec 8, 2022

Wrap a function with bun-livereload to automatically reload any imports inside the function the next time it is called

bun-livereload Wrap a function with bun-livereload to automatically reload any imports inside the function the next time it is called. import liveRelo

Dec 19, 2022

TypeScript isomorphic library to make work with Telegram Web Apps init data easier.

Telegram Web Apps Init Data TypeScript isomorphic library to make work with Telegram Web Apps init data easier. Feel free to use it in browser and Nod

Oct 7, 2022
Owner
Fabio Spampinato
Full-stack developer passionate about open source and empowering people.
Fabio Spampinato
Password Generator - A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords

A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords. Password Generator is free to use as a secure password generator on any computer, phone, or tablet.

Sebastien Rousseau 11 Aug 3, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Convert some JavaScript/TypeScript code string into a .d.ts TypeScript Declaration code string

convert-to-dts Converts the source code for any .js or .ts file into the equivalent .d.ts code TypeScript would generate. Usage import { convertToDecl

Lily Scott 11 Mar 3, 2022
Generate Password is a generating random and unique passwords.

Generate Password Generate Password is a generating random and unique passwords. Install $ npm install @wcj/generate-password --save Usage import { ge

小弟调调™ 4 Jun 16, 2022
A simple code that creates a string of random characters displayed in an html object, all saving in a json file.

I'm 17 Years Old Developer / Lead Developer. ?? I'm wroking on AdrenalinaRP, GrandRDM. ?? I’m currently learning JavaScript. ?? I’m looking to collabo

OFFVIXEN 2 Nov 17, 2022
An easy-to-use library to make your life easier when working with random numbers or random choices in javascript.

vrandom An easy-to-use library to make your life easier when working with random numbers or random choices in javascript. Table of contents Installati

Valerio Cipolla 1 Aug 16, 2022
A tiny script and component intended to be used with Astro for generating images with eleventy-img.

Astro + eleventy-img A tiny script and component intended to be used with Astro for generating images with eleventy-img. It also supports creating blu

Erika 36 Dec 16, 2022
An interactive list of plugins for hex-rays' IDA Pro

Interactive IDA Plugin List This is a comprehensive list of plugins for IDA Pro that is more interactive, that is, it can be sorted and filtered to he

Vincent Mallet 106 Dec 26, 2022