import hashlib
from util import hook
@hook.command
def md5(inp):
"md5 <text> -- Returns a md5 hash of <text>."
return hashlib.md5(inp).hexdigest()
def sha1(inp):
"sha1 <text> -- Returns a sha1 hash of <text>."
return hashlib.sha1(inp).hexdigest()
def sha256(inp):
"sha256 <text> -- Returns a sha256 hash of <text>."
return hashlib.sha256(inp).hexdigest()
def sha512(inp):
"sha512 <text> -- Returns a sha512 hash of <text>."
return hashlib.sha512(inp).hexdigest()
def hash(inp):
"hash <text> -- Returns hashes of <text>."
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
for x in ['md5', 'sha1', 'sha256'])