Skip to content

A fast string shortener that generates 8-character codes using SHA-256 and Base62 encoding, implemented as a native Node.js addon in C++.

Notifications You must be signed in to change notification settings

youhide/theShortener

Repository files navigation

CI NPM Publish

theShortener

A fast string shortener that generates 8-character codes using SHA-256 and Base62 encoding, implemented as a native Node.js addon in C++.

Features

  • Fast native C++ implementation
  • Consistent 8-character outputs
  • Cryptographically secure using SHA-256
  • Base62 encoding (0-9, a-z, A-Z)
  • Deterministic results - same input produces same output

Installation

npm install theshortener --save

Usage

const shortener = require('theshortener');

// Generate short code
const shortCode = shortener.gen('https://google.com');
console.log(shortCode); // Outputs: "Qhq1TQ2n"

CLI Usage

Install globally:

npm i -g theshortener

Use from command line:

theshortener https://google.com
Qhq1TQ2n

Development

Prerequisites:

  • Node.js
  • C++ compiler
  • OpenSSL development libraries

Build from source:

npm run build

Run tests:

npm test

Notes

  • Currently in BETA - not recommended for production use
  • The output is always 8 characters long
  • Uses OpenSSL for SHA-256 hashing
  • This is a one-way hashing implementation. Reverse lookups (getting original STR from short code) require storing STR-to-hash mappings in a database.

License

DY - Dunno Yet

About

A fast string shortener that generates 8-character codes using SHA-256 and Base62 encoding, implemented as a native Node.js addon in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project