Git Product home page Git Product logo

ssid's Introduction

SSID(Secure Short ID) Generator shortid

SSID Generator is a Node.js module that provides a secure and efficient way to generate short IDs, suitable for various use cases such as unique identifiers in databases, session IDs, URL shorteners, etc.

Features

  • Generates short IDs using a secure algorithm.
  • Customizable length for generated IDs.
  • Supports a wide range of characters, making IDs URL-friendly.
  • Ensures uniqueness of generated IDs, even in high-demand scenarios.
  • Suitable for applications where security and uniqueness are critical.

Installation

You can install the Secure Short ID Generator module via npm:

npm install ssid

Usage

const generateShortId = require('ssid');

// Generate a short ID with default length (8 characters)
const shortId = generateShortId();
console.log(shortId);

// Generate a short ID with custom length (e.g., 12 characters)
const customLengthShortId = generateShortId(12);
console.log(customLengthShortId);

API

generateShortId([length])

Generates a short ID with the specified length. If no length is provided, the default length is 8 characters.

  • length (optional): The length of the generated short ID (default is 8 characters). Minimum length is 4 characters and maximum length is 10,000 characters.

Returns: A string representing the generated short ID.

License

This project is licensed under the MIT License.

ssid's People

Contributors

rohitnirban avatar 22bai70785 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

22bai70785

ssid's Issues

Min/Max length do not exist

Issue Description

This package does not contain any min/max length which may create problems

Steps to Reproduce

  1. Install this package
  2. Import the package
    const generateShortId = require('ssid');
  3. Generate a new ssid by giving its length for eg: 100000
    const customLengthShortId = generateShortId(100000);

Expected Behavior

It should give maximum limit exceed or minimum limit can not be less than 4.

Actual Behavior

It generates ssid of any size as user wants

Environment

  • Operating System: Windows
  • Node.js version: 20
  • npm package version: 10

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.