Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

optimus-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optimus-js

Knuths multiplicative hashing based id obfuscation for javascript (port of https://github.com/jenssegers/optimus).

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
793
increased by19.07%
Maintainers
1
Weekly downloads
 
Created
Source

Knuth's integer hashing based id obfuscation

Build Status Latest build

This is a port of jenssegers/optimus PHP library for Javascript. It works on the browser as well as node.

Installation

npm install optimus-js
bower install optimus-js

Usage

To initialize the library you need 3 things.

  • Large prime number lower than 2147483647 (prime)
  • The inverse prime so that (prime * inverse) & 2147483647 = 1
  • A large random number lower than 2147483647

for more info and a command line too to generate these values please refer the original project

using the above parameters you can create instances of Optimus(prime, inverse, random)

var Optimus = require('optimus');

var optimus = new Optimus(1580030173, 59260789, 1163945558);

After that you can use encode and decode methods to encode/decode positive integers ranging from (0 to 2147483647).

var hash = optimus.encode(25);
var original = optimus.decode(hash);

Warning: Please note that this library only provides obfuscation and not encryption.

Keywords

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc