Catalog npm
PACKAGE EXPLORERView in registry

6bithash

npm

**Hash function package** for hashing id's ( in positive integer ) to an alphanumeric short string using a 6 bit map ( User can also prvide thier own Custom 6 bit map )

6bithashbit hashingbit mappingcustom bit mapexecutablehash functionhashing algorithmid hashingnano idnpm packageopen sourceshort idsix bit hashsixbithashtypescript
Versions collected6
Direct dependencies5From release 1.0.5
Last observed20 Oct, 20:50 UTC

README

Current package documentation

6bithash

Hash function package for hashing id's ( in positive integer ) to an alphanumeric short string using a 6 bit map ( User can also prvide thier own Custom 6 bit map )

I built this to solve the problem of getting short hash for numbers ( i was making a link shortner )

This is Made Using TypeScript and Node.js

How to use

Install with npm

npm install 6bithash

Install with pnpm

pnpm add 6bithash

Then, you can import the hash function as :

import { generateHash } from '6bithash';

or

const { generateHash } = require('6bithash');

Providing a custom hash function

The custom hash function must have key as 6bit integers and value as you want as a string.

Example:

import { generateHash } from '6bithash';
myMap = {
    "000000" : "u",
    ...
    ...
    "111111" : "o",
}
const Number = 1001;
const result = generateHash(Number,{myMap});

Note

  • The minimum number of characters in a string hash depends on the how big the number is.
  • Pass a larger number as a Argument to get a hash with more characters.
  • If you are using TypeScript the result type is string.

Example:

Javascript :

const result = generateHash(959492);
console.log(result); // result = dQqe

TypeScript :

const result:string = generateHash(959492);
console.log(result); // result = dQqe

File Structure

6bithash
├── dist
│ └── index.d.mts
│ └── index.d.ts
│ └── index.js
│ └── index.mjs
├── src
│ └── customMap.ts
│ └── index.ts
│ └── types.ts
├── tests
│ └── index.test.ts
├── .gitignore
├── License
├── pnpm-lock.yaml
├── package.json
├── jest.config.json
├── Readme.md
└── tsconfig.json
└── tsup.config.json

License

This project is licensed under the MIT License - see the LICENSE file for details.


Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 6

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.5Registry latest20 Dec 20245
1.0.417 Dec 20245
1.0.317 Dec 20245
1.0.217 Dec 20245
1.0.117 Dec 20245
1.0.017 Dec 20245

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
aniketvish0/6bithash

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:50 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:c09e4cc21cd1db4dcc621242af278f5d07e024d07c157a21537d72901c9a29e3