Provides simple encryption and decryption services based on node's crypto functionality.
npm install encrypto-decrypto
npm install encrypto-decrypto
`How to use
`
const encrypto_decrypto = require('encrypto-decrypto')const encryptoDecrypto = new encrypto_decrypto({
key: 'someReallyLongStringToUseAsAKey!',
iv: 'nonceString4Key!'
})
const encStr = encryptoDecrypto.encrypt('Hello World!')
console.log(encStr) // 65f1702da3ac2e2d28e4a972d3b955a4
const decrStr = encryptoDecrypto.decrypt('65f1702da3ac2e2d28e4a972d3b955a4')
console.log(decrStr) // Hello World!
`$3
key
_must be 32 characters long_iv
_must be 16 characters long_$3
algorithm [Defaults to _aes-256-cbc_]
_must be one of: aes-128-cbc, aes-192-cbc, aes-256-cbc, aes-128-ctr, aes-192-ctr, aes-256-ctr_inputEncoding [Defaults to _utf8_]
_must be one of: utf8, ascii, latin1_outputEncoding` [Defaults to _hex_]