Socket
Socket
Sign inDemoInstall

edge-uniqd

Package Overview
Dependencies
0
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    edge-uniqd

An irreversible ObjectID generator


Version published
Maintainers
2
Install size
11.5 kB
Created

Readme

Source

Uniqd

Uniqd is a irreversible ObjectId generator tool. Need a unique id for something? Uniqd is for you.

How to use?

Simple, just install it, require it and use it

  • Install it: npm install edge-uniqd
  • Require it:
    let uid = require('edge-uniqd');

    console.log(uid); // 00a4acfcdf2205cb89e8ea721e8def45

Under the hood

Uniqd will always return a 32bit ObjectID string, but what makes it really unique and irreversible? Well, first of all the script generate enough entropy taking some special data of the PC, like:

  • The time in seconds at the momment of the exection.
  • The ProcessId (pid).
  • The fingerprint of your PC.
  • A random 16bits ID string.

The fingerprint is where all the "heavy" entropy is made because the script makes a big string with this data:

  • freemem
  • homedir
  • hostname
  • uptime
  • user
  • mac-adress
  • IP

Then we take this full data an hash it with crypto.createHash and the md5 algoritm... the result is an irreversible 32bit hasehd string.

Keywords

FAQs

Last updated on 09 Apr 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc