{
  "_id": "hexoid",
  "maintainers": [
    {
      "name": "lukeed",
      "email": "luke@lukeed.com"
    }
  ],
  "keywords": [
    "id",
    "uid",
    "uuid",
    "random",
    "generate"
  ],
  "dist-tags": {
    "latest": "2.0.0"
  },
  "author": {
    "name": "Luke Edwards",
    "email": "luke.edwards05@gmail.com",
    "url": "https://lukeed.com"
  },
  "_rev": "3-2cad74b267f03f2046ff0a396893ba5f",
  "description": "A tiny (190B) and extremely fast utility to generate random IDs of fixed length",
  "readme": "# hexoid [![CI](https://github.com/lukeed/hexoid/workflows/CI/badge.svg)](https://github.com/lukeed/hexoid/actions) [![licenses](https://licenses.dev/b/npm/hexoid)](https://licenses.dev/npm/hexoid) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/hexoid)](https://codecov.io/gh/lukeed/hexoid)\n\n> A tiny (190B) and [extremely fast](#benchmarks) utility to generate random IDs of fixed length\n\n_**Hexadecimal object IDs.** Available for Node.js and the browser._<br>Generate randomized output strings of fixed length using lowercased hexadecimal pairs.\n\n> **Notice:** Please note that this is not a cryptographically secure (CSPRNG) generator.\n\nAdditionally, this module is delivered as:\n\n* **CommonJS**: [`dist/index.js`](https://unpkg.com/hexoid/dist/index.js)\n* **ES Module**: [`dist/index.mjs`](https://unpkg.com/hexoid/dist/index.mjs)\n\n## Install\n\n```\n$ npm install --save hexoid\n```\n\n\n## Usage\n\n```js\nimport { hexoid } from 'hexoid';\n\nconst toID = hexoid();\n// length = 16 (default)\ntoID(); //=> '52032fedb951da00'\ntoID(); //=> '52032fedb951da01'\ntoID(); //=> '52032fedb951da02'\n\n// customize length\nhexoid(25)(); //=> '065359875047c63a037200e00'\nhexoid(32)(); //=> 'ca8e4aec7f139d94fcab9cab2eb89f00'\nhexoid(48)(); //=> 'c19a4deb5cdeca68534930e67bd0a2f4ed45988724d8d200'\n```\n\n\n## API\n\n### hexoid(length?)\nReturns: `() => string`\n\nCreates the function that will generate strings.\n\n#### length\nType: `Number`<br>\nDefault: `16`\n\nThen length of the output string.\n\n> **Important:** Your risk of collisions decreases with longer strings!<br>Please be aware of the [Birthday Problem](https://betterexplained.com/articles/understanding-the-birthday-paradox/)! You may need more combinations than you'd expect.\n\nThe **maximum combinations** are known given the following formula:\n\n```js\nconst combos = 256 ** (len/2);\n```\n\n\n## Benchmarks\n\n> Running on Node.js v10.13.0\n\n```\nValidation (length = 16):\n  ✔ hashids/fixed        (example: \"LkQWjnegYbwZ1p0G\")\n  ✔ nanoid/non-secure    (example: \"sLlVL5X3M5k2fo58\")\n  ✔ uid                  (example: \"3d0ckwcnjiuu91hj\")\n  ✔ hexoid               (example: \"de96b62e663ef300\")\nBenchmark (length = 16):\n  hashids/fixed        x     349,462 ops/sec ±0.28% (93 runs sampled)\n  nanoid/non-secure    x   3,337,573 ops/sec ±0.28% (96 runs sampled)\n  uid                  x   3,553,482 ops/sec ±0.51% (90 runs sampled)\n  hexoid               x  81,081,364 ops/sec ±0.18% (96 runs sampled)\n\n\nValidation (length = 25):\n  ✔ cuid                 (example: \"ck7lj5hbf00000v7c9gox6yfh\")\n  ✔ hashids/fixed        (example: \"r9JOyLkQWjnegYbwZ1p0GDXNm\")\n  ✔ nanoid/non-secure    (example: \"hI202PVPJQRNrP6o6z4pXz4m0\")\n  ✔ uid                  (example: \"9904e9w130buxaw7n8358mn2f\")\n  ✔ hexoid               (example: \"01dfab2c14e37768eb7605a00\")\nBenchmark (length = 25):\n  cuid                 x     161,636 ops/sec ±1.36% (89 runs sampled)\n  hashids/fixed        x     335,439 ops/sec ±2.40% (94 runs sampled)\n  nanoid/non-secure    x   2,254,073 ops/sec ±0.23% (96 runs sampled)\n  uid                  x   2,483,275 ops/sec ±0.38% (95 runs sampled)\n  hexoid               x  75,715,843 ops/sec ±0.27% (95 runs sampled)\n\n\nValidation (length = 36):\n  ✔ uuid/v1              (example: \"c3dc1ed0-629a-11ea-8bfb-8ffc49585f54\")\n  ✔ uuid/v4              (example: \"8c89f0ca-f01e-4c84-bd71-e645bab84552\")\n  ✔ hashids/fixed        (example: \"EVq3Pr9JOyLkQWjnegYbwZ1p0GDXNmRBlAxg\")\n  ✔ @lukeed/uuid         (example: \"069ad676-48f9-4452-b11d-f20c3872dc1f\")\n  ✔ nanoid/non-secure    (example: \"jAZjrcDmHH6P1rT9EFdCdHUpF440SjAKwb2A\")\n  ✔ uid                  (example: \"5mhi30lgy5d0glmuy81llelbzdko518ow1sx\")\n  ✔ hexoid               (example: \"615209331f0b4630acf69999ccfc95a23200\")\nBenchmark (length = 36):\n  uuid/v1              x   1,487,947 ops/sec ±0.18% (98 runs sampled)\n  uuid/v4              x     334,868 ops/sec ±1.08% (90 runs sampled)\n  @lukeed/uuid         x   6,352,445 ops/sec ±0.27% (91 runs sampled)\n  hashids/fixed        x     322,914 ops/sec ±0.27% (93 runs sampled)\n  nanoid/non-secure    x   1,592,708 ops/sec ±0.25% (91 runs sampled)\n  uid                  x   1,789,492 ops/sec ±0.29% (92 runs sampled)\n  hexoid               x  71,746,692 ops/sec ±0.29% (93 runs sampled)\n```\n\n## Related\n\n- [uid](https://github.com/lukeed/uid) - A smaller (134B) but slower variant of this module with a different API\n- [@lukeed/uuid](https://github.com/lukeed/uuid) - A tiny (230B), fast, and cryptographically secure UUID (V4) generator for Node and the browser\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/lukeed/hexoid.git"
  },
  "bugs": {
    "url": "https://github.com/lukeed/hexoid/issues"
  },
  "license": "MIT",
  "versions": {
    "0.0.0": {
      "name": "hexoid",
      "version": "0.0.0",
      "keywords": [],
      "author": {
        "url": "https://lukeed.com",
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com"
      },
      "license": "MIT",
      "_id": "hexoid@0.0.0",
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "homepage": "https://github.com/lukeed/hexoid#readme",
      "bugs": {
        "url": "https://github.com/lukeed/hexoid/issues"
      },
      "dist": {
        "shasum": "e7409c8e86198e94406c5da84acca2d24820725a",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/hexoid/-/hexoid-0.0.0.tgz",
        "fileCount": 3,
        "integrity": "sha512-ij9yUifOygfN4yxgFm9uEaCWMOWCTvjFUTUSY3sfoK6vRQKNRVHRyxl/Ko6APaV6lI1ENA6J4i/Cu4UBzIxCFg==",
        "signatures": [
          {
            "sig": "MEYCIQDOdOUG0ZZZ1moZB6T7YDu86TAh1CD1VeIshZM5HqCKsQIhAJC+BAYzBA/ViG8Ej6d4LxoeLVcLgZ4euyKAA8jquRWt",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 1849,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXe2/CRA9TVsSAnZWagAACw8QAIzuSO2p8KxyK9eTvMMi\n7qyAywQl68Ph7q8Oq9YTvxyQLzzJwBVmM+e7zk5cDOoWMBej44gDGwaimwe5\nfIa/Csmt05eNsc0CRMuWGEzY1zX5q26GK5NsdwZuX9i8kGThnoZcXKKs4u8h\nsweY4gk6Mv3cGiUVR0P4gp7tiDff9WPoEuK+7wvV+F2WldteXqxiyDS+evtB\n009RxqNYqRSFHy9Wca7FLnJYywBTAi5mCpCFziD3o11/BTbjOzpKgj4QijZr\nCvkKfdTJ0kfGbWTzl3dfZTIkYMESJGp88wu0wJ7PULFVw6qbpjm4Ekibd4PQ\nW+6pR7mcxLlDnwOow8xyO50EZu0FQeIj8AKhNjCjZ+HrPSTJNumg4BzxkABO\nStnsPzBKA49ibWdxn152x8u4sIju5KHjnnVQvxJ9JTokhqH34d2rEsXCtXob\n717RVfV1l9F+cyvjC0Mt2eib25F3LB3yTAkCnSar5rUlkuuKBKr2VoTC0MA5\ntxqDBEMjq+pCkr+U/1zXGaPFOL3vatouJkk4Sl+IOUrZ4GkVGhmrIK18TNQr\nnDOHjNABXTjeblblvW/Phwn11EALgBayaMBEGLEykzh4c5S8lHOaEPc+q7s4\nGXKxJnB3W+7iNEM/d2nKE3NZxH/ccc1QmHsV1w9mbsExMeqAlsp4GNtDT1uv\n9Ixh\r\n=feT4\r\n-----END PGP SIGNATURE-----\r\n"
      },
      "main": "dist/index.js",
      "types": "foid.d.ts",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "engines": {
        "node": ">=8"
      },
      "gitHead": "a79c327d82dff81e303b2e96b9c1765361239fb5",
      "scripts": {
        "test": "tape -r esm test/*.js | tap-spec",
        "build": "bundt",
        "pretest": "npm run build"
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "repository": {
        "url": "git+https://github.com/lukeed/hexoid.git",
        "type": "git"
      },
      "_npmVersion": "6.4.1",
      "description": "WIP",
      "directories": {},
      "_nodeVersion": "10.13.0",
      "_hasShrinkwrap": false,
      "devDependencies": {
        "esm": "3.2.25",
        "tape": "4.9.1",
        "bundt": "1.0.0",
        "tap-spec": "5.0.0"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/hexoid_0.0.0_1583214014843_0.294624000153179",
        "host": "s3://npm-registry-packages"
      }
    },
    "1.0.0": {
      "name": "hexoid",
      "version": "1.0.0",
      "keywords": [
        "id",
        "uid",
        "uuid",
        "random",
        "generate"
      ],
      "author": {
        "url": "https://lukeed.com",
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com"
      },
      "license": "MIT",
      "_id": "hexoid@1.0.0",
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "homepage": "https://github.com/lukeed/hexoid#readme",
      "bugs": {
        "url": "https://github.com/lukeed/hexoid/issues"
      },
      "dist": {
        "shasum": "ad10c6573fb907de23d9ec63a711267d9dc9bc18",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/hexoid/-/hexoid-1.0.0.tgz",
        "fileCount": 7,
        "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==",
        "signatures": [
          {
            "sig": "MEQCIC2zQpkM8jkA03suuccG/ZywjbyiHmB/ay2ZQd5CZcEmAiAsr7PkFSitSSuhLIbYhd+7T0WvezWs7hhC0PQAZYt9Yw==",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 7718,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZzrQCRA9TVsSAnZWagAAFZQP/iwjwHXOQnpNSdoHlbhw\naJtsLZcUg95K+dPOjGTwp2EGTPQlMTISO0vI4pjzuFscPL8KFn691ghV4l9N\nU5EzlhvUTdUvfRb677wAh2ApusrKeUTYGuo0IictqkHkOUjURnp9Ntoa8oY/\nQ7A3XstYuE/CycatZ/CgKNdS7PxilVnA9TC2ItOpkD0SPIrUa6olHTso3Tvs\nl3LaRFesSjV/hlB9sDY9sc3m+NEutfujCWtMVHA+ZTxBX/871YJRDQj9+clk\nvXbypWFnZugORHiMzgCdO8z3N/u+nqG+VlbpO3H8vDEobh8uHQEqnMJO+4iD\n40ryVz5OUUiCTRJMEKHF92YnoTxXNpP20L9W4IlVIrs6vadhWCNw4qkjhT9M\nnrD21QYBO0ofnPkUPAzQ/kgNEw1zlhmS2qAVFspWroBT6A7Y3TIEYa4dylEV\np44fwyepakVDnoo0je4b92WqNnQN9DdSrBAMy4nivQxG9mI6W46r+tyFBXhu\nYk0a67qrCN6bXuEkhCsyqdCex1q609m6Yc2n+QCMOlWFMivnbiWSlxGM0+UW\n2pGDwi9yfINdCFuISLEZALSKnPYkqcWO58uI/ji3iNW1ABP64ZCADuGfonD8\nqdFdra3gkmQiJOOzgcSuQc2C+xDBzJFxZ0/FLEa9piWAAJ8dvNYl3cj+oAyF\n66rT\r\n=hl/A\r\n-----END PGP SIGNATURE-----\r\n"
      },
      "main": "dist/index.js",
      "types": "hexoid.d.ts",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "engines": {
        "node": ">=8"
      },
      "gitHead": "a559503e2f8886060a6972975a9c34a49dcd46b2",
      "scripts": {
        "test": "tape -r esm test/*.js | tap-spec",
        "build": "bundt",
        "pretest": "npm run build"
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "repository": {
        "url": "git+https://github.com/lukeed/hexoid.git",
        "type": "git"
      },
      "_npmVersion": "6.4.1",
      "description": "A tiny (190B) and extremely fast utility to generate random IDs of fixed length",
      "directories": {},
      "_nodeVersion": "10.13.0",
      "_hasShrinkwrap": false,
      "devDependencies": {
        "esm": "3.2.25",
        "tape": "4.9.1",
        "bundt": "1.0.0",
        "tap-spec": "5.0.0"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/hexoid_1.0.0_1583823567474_0.11775983696085879",
        "host": "s3://npm-registry-packages"
      }
    },
    "2.0.0": {
      "name": "hexoid",
      "version": "2.0.0",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/lukeed/hexoid.git"
      },
      "description": "A tiny (190B) and extremely fast utility to generate random IDs of fixed length",
      "module": "dist/index.mjs",
      "types": "dist/index.d.ts",
      "main": "dist/index.js",
      "license": "MIT",
      "author": {
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com",
        "url": "https://lukeed.com"
      },
      "engines": {
        "node": ">=8"
      },
      "scripts": {
        "build": "node bin/build",
        "test": "uvu test -r esm -i collisions"
      },
      "exports": {
        ".": {
          "types": "./dist/index.d.ts",
          "import": "./dist/index.mjs",
          "require": "./dist/index.js"
        },
        "./package.json": "./package.json"
      },
      "keywords": [
        "id",
        "uid",
        "uuid",
        "random",
        "generate"
      ],
      "devDependencies": {
        "esm": "3.2.25",
        "terser": "4.8.0",
        "uvu": "0.5.3"
      },
      "_id": "hexoid@2.0.0",
      "gitHead": "a23cb66b42595b3c6c443ca2bbea9aac50504cc9",
      "bugs": {
        "url": "https://github.com/lukeed/hexoid/issues"
      },
      "homepage": "https://github.com/lukeed/hexoid#readme",
      "_nodeVersion": "20.10.0",
      "_npmVersion": "10.2.3",
      "dist": {
        "integrity": "sha512-qlspKUK7IlSQv2o+5I7yhUd7TxlOG2Vr5LTa3ve2XSNVKAL/n/u/7KLvKmFNimomDIKvZFXWHv0T12mv7rT8Aw==",
        "shasum": "fb36c740ebbf364403fa1ec0c7efd268460ec5b9",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/hexoid/-/hexoid-2.0.0.tgz",
        "fileCount": 6,
        "unpackedSize": 7156,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIEflwoGuTgyd79JsyC1/CWmNEQspDRK2yUYSEA6WxyAUAiAKdrexbCy+3Hrg6viPebDZVE7a5OKaqtioqkT0HafYrQ=="
          }
        ]
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/hexoid_2.0.0_1728722888508_0.22115292778774265"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "hexoid",
  "time": {
    "created": "2020-03-03T05:40:14.843Z",
    "modified": "2026-05-30T09:12:02.266Z",
    "0.0.0": "2020-03-03T05:40:15.006Z",
    "1.0.0": "2020-03-10T06:59:27.688Z",
    "2.0.0": "2024-10-12T08:48:08.718Z"
  },
  "readmeFilename": "readme.md",
  "homepage": "https://github.com/lukeed/hexoid#readme"
}