cryptlib uses AES 256 for encryption or decryption. This library can be used for encryption and decryption of strings using Node on iOS and Android
npm install @ahmetulusoy/cryptlibnpm install @@ahmetulusoy/cryptlib --save
javascript
const plainText = "this is my plain text";
const key = "your key";
const cryptLib = require('@@ahmetulusoy/cryptlib');
const cipherText = cryptLib.encryptPlainTextWithRandomIV(plainText, key);
console.log('cipherText %s', cipherText);
const decryptedString = cryptLib.decryptCipherTextWithRandomIV(cipherText, key);
console.log('decryptedString %s', decryptedString);
`
$3
`javascript
const cryptLib = require('@@ahmetulusoy/cryptlib');
const iv = cryptLib.generateRandomIV(16); //16 bytes = 128 bit
const key = cryptLib.getHashSha256('my secret key', 32); //32 bytes = 256 bits
const cipherText = cryptLib.encrypt('This is the text to be encrypted', key, iv);
console.log(cipherText);
const decryptedString = cryptLib.decrypt(cipherText, key, iv);
console.log(decryptedString);
`
Run Code Sample
npm start
Tests
npm test`