-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCryptoTool.js
43 lines (36 loc) · 1.5 KB
/
CryptoTool.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/****************************************************************************************************
* CryptoTools.js
* Tool for encrypting / decrypting paddlers information
****************************************************************************************************/
const crypto = require('crypto');
const algorithm = '';
const password = '';
/****************************************************************************************************
* Encrypt
****************************************************************************************************/
function encrypt(text) {
var cipher = crypto.createCipher(algorithm, password)
var crypted = cipher.update(text, 'utf8', 'hex')
crypted += cipher.final('hex');
return crypted;
}
/****************************************************************************************************
* Decrypt
****************************************************************************************************/
function decrypt(text) {
var decipher = crypto.createDecipher(algorithm, password)
var dec = decipher.update(text, 'hex', 'utf8')
dec += decipher.final('utf8');
return dec;
}
/****************************************************************************************************
* Array of paddler's info
****************************************************************************************************/
var paddlers =
[
''
];
paddlers.forEach(function (paddler) {
console.log(encrypt(paddler));
// console.log(decrypt(paddler));
});