sec-obfuscate
v2.0.2
Published
Obfuscate IDs in a secure way!
Downloads
5
Maintainers
Readme
sec-obfuscate
sec-obfuscate is a fork of the original sec-obfuscate-nodejs last updated in 2014. There have been deprecations since then, so this library addresses those.
sec-obfuscate is a library which obfuscates numbers (IDs etc...) using ciphers from OpenSSL.
Parameters
var SecObfuscate = require("sec-obfuscate"),
secObfuscate = new SecObfuscate(key, iv, [cipher], [blockLength]);
cipher
is a name of a encrption algorithm in OpenSSL notation. Default value is AES-256-CTR.
blockLength
is a length of the output block. It have to be a multiple of 8. Default value is 32.
Ciphers
Currently only stream cipher (RC4) or AES with stream modes of operation are available:
- RC4
- AES-128-CTR
- AES-128-GCM
- AES-128-OFB
- AES-192-CTR
- AES-192-GCM
- AES-192-OFB
- AES-256-CTR
- AES-256-GCM
- AES-256-OFB
Usage
Code below presents a simple example of how the library can be used. More examples are available in test directory.
var SecObfuscate = require("sec-obfuscate"),
key = '0123456789abcdef0123456789abcdef',
iv = '0123456789abcdef'
secObfuscate = new SecObfuscate(key, iv),
encryptedValue = secObfuscate.encrypt(42),
decryptedValue = secObfuscate.decrypt(encryptedValue),