edge-uniqd

1.0.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i edge-uniqd

Weekly Downloads

1

Version

1.0.0

License

LGPL-3.0

Unpacked Size

11.8 kB

Total Files

7

Last publish

Collaborators

  • jmlevick
  • nanotime