(data, password)
| 8 | |
| 9 | // 创建加密算法 |
| 10 | const aseEncode = function(data, password) { |
| 11 | |
| 12 | // 如下方法使用指定的算法与密码来创建cipher对象 |
| 13 | const cipher = crypto.createCipher('aes192', password); |
| 14 | |
| 15 | // 使用该对象的update方法来指定需要被加密的数据 |
| 16 | let crypted = cipher.update(data, 'utf-8', 'hex'); |
| 17 | |
| 18 | crypted += cipher.final('hex'); |
| 19 | |
| 20 | return crypted; |
| 21 | }; |
| 22 | |
| 23 | // 创建解密算法 |
| 24 | const aseDecode = function(data, password) { |