Notwithstanding Previous Misdemeanors

    uuid-by-string
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.5 • Public • Published

    uuid-by-string NPM Downloads Build Status

    Generates the RFC-4122 Name-Based UUID. Supports 3 and 5 versions of UUID.

    Installation

    # via NPM
    npm install uuid-by-string
    
    # or Yarn
    yarn add uuid-by-string

    Usage

    The package has only one default exported method. Method receives any string and returns generated hash

    const getUuid = require('uuid-by-string')
    
    const uuidHash = getUuid('Hello world!')
    // d3486ae9-136e-5856-bc42-212385ea7970

    The string Hello world! will always returns d3486ae9-136e-5856-bc42-212385ea7970.

    You can specify the UUID version. Available versions is 3 and 5 according to RFC-4122. The version is responsible for the hashing algorithm: version 3 uses MD5, and version 5 uses SHA-1. SHA-1 used by default if version is not specified.

    const uuidV3Hash = getUuid('Hello world!', 3)
    // 86fb269d-190d-3c85-b6e0-468ceca42a20
    
    const uuidV5Hash = getUuid('Hello world!', 5)
    // d3486ae9-136e-5856-bc42-212385ea7970

    License

    MIT licensed

    Install

    npm i uuid-by-string

    DownloadsWeekly Downloads

    35,335

    Version

    3.0.5

    License

    MIT

    Unpacked Size

    789 kB

    Total Files

    16

    Last publish

    Collaborators

    • danakt