-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (38 loc) · 1.36 KB
/
index.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
44
var stdenc2009 = require('./standard_encryption_2009');
var stdenc2012 = require('./standard_encryption_2012');
var aes = require('./aes');
var sha256 = require('./coolimage_sha256');
function encrypt2009(site, city, pass) {
// capitalize city
var master = stdenc2009.calcMaster(city, pass);
var str = stdenc2009.calc2009a(master, site.toLowerCase());
return str;
}
function encrypt2009b(site, city, pass) {
// capitalize city
var master = stdenc2009.calcMaster(city, pass);
var str = stdenc2009.calc2009b(master, site.toLowerCase());
return str;
}
function encrypt2012(site, city, pass) {
var unihash = stdenc2012.unihash(city, pass); //city,pass (city in lowercase)
var str = stdenc2012.calc2012(unihash, site.toLowerCase());
return str;
}
function encrypt2012new(site, city, pass) {
var unihash = stdenc2012.unihash(city, pass); //city,pass (city in lowercase)
var str = stdenc2012.calc2012new(unihash, site.toLowerCase());
return str;
}
// sample usage via console
if (process != null && process.argv.length > 4) {
console.log(encrypt2012(process.argv[2], process.argv[3], process.argv[4]));
}
exports.encrypt2009 = encrypt2009;
exports.encrypt2009b = encrypt2009b;
exports.encrypt2012 = encrypt2012;
exports.encrypt2012new = encrypt2012new;
exports.aes = aes;
exports.sha256 = sha256.sha;
exports.stdenc2009 = stdenc2009;
exports.stdenc2012 = stdenc2012;