hash util function

This commit is contained in:
Daniel Odendahl Jr
2018-03-05 04:10:15 +00:00
parent 511154ef23
commit 6ee7cea56b
4 changed files with 13 additions and 8 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const crypto = require('crypto');
const { hash } = require('../../util/Util');
module.exports = class MD5Command extends Command {
constructor(client) {
@@ -20,6 +20,6 @@ module.exports = class MD5Command extends Command {
}
run(msg, { text }) {
return msg.say(crypto.createHash('md5').update(text).digest('hex'));
return msg.say(hash(text, 'md5'));
}
};
+2 -2
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const crypto = require('crypto');
const { hash } = require('../../util/Util');
module.exports = class SHA256Command extends Command {
constructor(client) {
@@ -20,6 +20,6 @@ module.exports = class SHA256Command extends Command {
}
run(msg, { text }) {
return msg.say(crypto.createHash('sha256').update(text).digest('hex'));
return msg.say(hash(text, 'sha256'));
}
};