0.2.2-dev • Published 9 years ago
jcrypto v0.2.2-dev
jCrypto
These are an experimental white-box cryptography tools for JavaScript obfuscation.
Algorithms
- white-box AES128-CTR
- white-box HMAC-SHA256
Installation
npm install jcryptoor
git clone https://github.com/tsu-iscd/jcrypto.git
cd jcrypto
npm installAPI
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:hexorstr(default)wrapper-- code wrapping; posible values:UMD,IIFEor nothing (default)mangle-- mangle names/properties option, properties cache file./aes-cache.jsonfor aes and./hmac-cache.jsonfor 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 arehexorstr(default)
Hashing
var hash = require('path/to/hmac.js');
var text = 'Hello, world!';
var options = {
encoding: 'str'
}
var output = hash(text, options);
// 8dcb6767c395b28b46ea0f0216cb3aa25b6ff46f0181ab035f3cf7fd3914c45eHashing options:
encoding-- text encoding; posible values arehexorstr(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.jsContributors
- Denis Kolegov
- Oleg Broslavsky
- Nikita Oleksov
References
0.2.2-dev
9 years ago
0.2.1-dev
9 years ago
0.2.0-dev
9 years ago
0.1.1-dev
9 years ago
0.1.2-alpa
9 years ago
0.1.1-alpa
9 years ago
0.1.0-alpa
9 years ago
0.1.0-dev
9 years ago