Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
| const cryptojs = require('crypto-js') | |
| const bin2hex = (s) => { | |
| var v, i, f = 0, a = []; | |
| s += ''; | |
| f = s.length; | |
| for (i = 0; i < f; i++) { | |
| a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/, "0$1"); | |
| } |
| const crypto = require('crypto'); | |
| const encrypt = (text, secret, prefix) => { | |
| // make buffer length 12 | |
| const iv = Buffer.alloc(12); | |
| const key = crypto.createHash('md5').update(secret).digest("hex"); | |
| // AES 256 GCM Mode |