h/plugins/hash.py

21 lines
375 B
Python
Raw Normal View History

2009-03-15 06:51:39 +00:00
import hashlib
from util import hook
@hook.command
def md5(inp):
return hashlib.md5(inp).hexdigest()
2009-03-15 06:51:39 +00:00
@hook.command
def sha1(inp):
return hashlib.sha1(inp).hexdigest()
2009-03-15 06:51:39 +00:00
@hook.command
def hash(inp):
".hash <text> -- returns hashes of <text>"
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
2009-03-15 06:51:39 +00:00
for x in 'md5 sha1 sha256'.split())