npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jcrypto

v0.2.2-dev

Published

JavaScript white-box cryptography tools.

Downloads

15

Readme

jCrypto

These are an experimental white-box cryptography tools for JavaScript obfuscation.

Algorithms

  • white-box AES128-CTR
  • white-box HMAC-SHA256

Installation

npm install jcrypto

or

git clone https://github.com/tsu-iscd/jcrypto.git
cd jcrypto
npm install

API

Code generation

var key = '0123456789abcdef';
var jcrypto = require('jcrypto');
var options = {  
    encoding: 'hex',
    wrapper: 'UMD',
    mangle: {  
        names: true,
        properties: true
   },
   file: 'path/to/aes.js'
};
// btw you can call it without options argument, default options described below
jcrypto.generateAes(key, options);

options.file = 'path/to/hmac.js';
jcrypto.generateHmac(key, options);

Code generation options:

  • encoding -- key characters encoding; posible values: hex or str (default)
  • wrapper -- code wrapping; posible values: UMD, IIFE or nothing (default)
  • mangle -- mangle names/properties option, properties cache file ./aes-cache.json for aes and ./hmac-cache.json for hmac; possible values: {names: true, properties: true} (default both false)
  • file -- output file option; path to file or return value (default)

Encryption

var aes = require('path/to/aes.js');
var plaintext = 'Hello, world!';
var options = {
    counter: '1826e4111826e4111826e4111826e411', 
    encoding: 'str'
};
var ciphertext = aes.encrypt(plaintext, options);
var output = aes.decrypt(ciphertext, options);
// Hello, world!

Encryption options:

  • counter -- counter for CTR AES mode; string 32 symbols (default 0)
  • encoding -- plain text or encrypt text encoding; posible values are hex or str(default)

Hashing

var hash = require('path/to/hmac.js');
var text = 'Hello, world!';
var options = {
    encoding: 'str'
}
var output = hash(text, options);
// 8dcb6767c395b28b46ea0f0216cb3aa25b6ff46f0181ab035f3cf7fd3914c45e

Hashing options:

  • encoding -- text encoding; posible values are hex or str(default)

Command line interface

The bin/jcrypto utility can be used to generate code of white-box crypto algorithm. It accepts as arguments its secret key, output file and the following options:

  • -a, --algorithm - crypto algorithms: aes, hmac.
  • -h, --help - display help.
  • -k, --key - secret key.
  • -e, --encoding - key characters encoding; posible values: hex.
  • -o, --output - output file.

Example:

$ bin/jcrypto -a aes -k 1234567891234567 -o wbaes.js

Contributors

  • Denis Kolegov
  • Oleg Broslavsky
  • Nikita Oleksov

References

  1. [En] [Oleg Broslavsky, Denis Kolegov, Nikita Oleksov. White-Box HMAC.] (http://www.slideshare.net/yalegko/whitebox-hmac-make-your-cipher-secure-to-whitebox-attacks)
  2. [Ru] Oleg Broslavsky, Denis Kolegov, Nikita Oleksov. HMAC Obfuscation Method for Implementation in Untrusted Systems.