Hexoid is a minimalist (190B) and high-performance utility designed for generating fixed-length, randomized hexadecimal IDs in JavaScript environments, including Node.js and browsers. The current stable version is 2.0.0, which introduced significant changes for improved module interoperability. It is primarily used when a quick, unique string identifier is needed, but cryptographic security is not a requirement. Key differentiators include its extreme speed, small footprint, and focus on simple hexadecimal output, contrasting with larger, more feature-rich UUID libraries. While it provides good collision resistance for common use cases, users must be aware it is not cryptographically secure and the risk of collisions increases with shorter lengths, as detailed by the Birthday Problem.
npm install hexoidVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the `hexoid` function and generate IDs with default and custom lengths.
Update your imports from `import hexoid from 'hexoid';` to `import { hexoid } from 'hexoid';` for ESM, and from `const hexoid = require('hexoid');` to `const { hexoid } = require('hexoid');` for CommonJS.Ensure your project's `tsconfig.json` (if using TypeScript) or bundler configuration supports `node16` or `nodenext` module resolution if experiencing module resolution issues.
For security-sensitive ID generation (e.g., session tokens, password resets), use a CSPRNG-backed library like `crypto.randomUUID()` in Node.js or `window.crypto.getRandomValues()` in browsers.
Always consider the required number of unique IDs and choose a sufficiently long ID length. The README provides a formula `256 ** (len/2)` for calculating maximum combinations to assess collision risk.
Change your import statement from `import hexoid from 'hexoid';` to `import { hexoid } from 'hexoid';`.Change your CommonJS import from `const hexoid = require('hexoid');` to `const { hexoid } = require('hexoid');`.No dependency data recorded yet.