forked from jtordgeman/Modular-Node.js-IRC-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhashes.js
43 lines (41 loc) · 1.36 KB
/
hashes.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
"use strict";
var settings = require('../config').settings;
var crypto = require("crypto");
var sha256 = crypto.createHash("sha256");
var md5 = crypto.createHash("md5");
var sha1 = crypto.createHash("sha1");
var sha512 = crypto.createHash("sha512");
exports.module = function() {
this.onCommand_sha256 = function(nick, args) {
if(args.trim() !== "") {
sha256.update(args, "utf8");
this.channel.say(sha256.digest("base64"));
} else {
this.channel.say("You're doing it wrong.\nUsage: " + settings.defaultCommandPrefix + "sha256 <Message>");
}
};
this.onCommand_md5 = function(nick, args) {
if(args.trim() !== "") {
md5.update(args, "utf8");
this.channel.say(md5.digest("base64"));
} else {
this.channel.say("You're doing it wrong.\nUsage: " + settings.defaultCommandPrefix + "md5 <Message>");
}
};
this.onCommand_sha1 = function(nick, args) {
if(args.trim() !== "") {
sha1.update(args, "utf8");
this.channel.say(sha1.digest("base64"));
} else {
this.channel.say("You're doing it wrong.\nUsage: " + settings.defaultCommandPrefix + "sha1 <Message>");
}
};
this.onCommand_sha512 = function(nick, args) {
if(args.trim() !== "") {
sha512.update(args, "utf8");
this.channel.say(sha512.digest("base64"));
} else {
this.channel.say("You're doing it wrong.\nUsage: " + settings.defaultCommandPrefix + "sha512 <Message>");
}
};
};