summaryrefslogtreecommitdiffstats
path: root/src/utils/Crypto.js
blob: c2b34a01278b7ff82975ca2337831d2895434b11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * Created by salmaat on 7/13/2017.
 */
import CryptoJS from 'crypto-js';

var key = 'key2017';

function encrypt(text) {
  var encrypted = CryptoJS.AES.encrypt(text, key);
  return encrypted.toString().split('/').join('*');
}

function decrypt(text) {
  var decrypted = CryptoJS.AES.decrypt(text.split('*').join('/'), key);
  return decrypted.toString(CryptoJS.enc.Utf8);
}


module.exports = {
  encrypt: encrypt,
  decrypt: decrypt
};