aboutsummaryrefslogtreecommitdiff
path: root/modules/hash.py
diff options
context:
space:
mode:
authorGravatar dngfx2018-08-31 10:50:37 +0100
committerGravatar dngfx2018-08-31 10:50:37 +0100
commitabed9cf4ea71dcbad2dd2c049683b8d14b942e09 (patch)
tree3e40caf63fa7e1500469f4ad9a0c45c51808aad4 /modules/hash.py
parentFix a copy paste fail in IRCLineHandler that caused PARTs to be handled as QUITs (diff)
signature
Reformat
Diffstat (limited to 'modules/hash.py')
-rw-r--r--modules/hash.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/hash.py b/modules/hash.py
index 86657bd1..5cacda2f 100644
--- a/modules/hash.py
+++ b/modules/hash.py
@@ -1,18 +1,20 @@
import hashlib
+
class Module(object):
def __init__(self, bot):
self.bot = bot
bot.events.on("received").on("command").on("hash"
- ).hook(self.hash, min_args=2, help="Hash a string",
- usage="<algo> <string>")
+ ).hook(self.hash, min_args=2,
+ help="Hash a string",
+ usage="<algo> <string>")
def hash(self, event):
algorithm = event["args_split"][0].lower()
if algorithm in hashlib.algorithms_available:
phrase = " ".join(event["args_split"][1:])
cipher_text = hashlib.new(algorithm, phrase.encode("utf8")
- ).hexdigest()
+ ).hexdigest()
event["stdout"].write("%s -> %s" % (phrase, cipher_text))
else:
event["stderr"].write("Unknown algorithm provided")