Python/hashlib

From Fundamental Ramen
< Python
Revision as of 03:25, 1 October 2019 by Tacoball (talk | contribs) (Created page with "<source lang="python3"> def md5_hex(data): if isinstance(data, str): data = data.encode('ascii') ho = hashlib.new('md5') ho.update(data) return ho.hexd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
def md5_hex(data):
    if isinstance(data, str):
        data = data.encode('ascii')
    ho = hashlib.new('md5')
    ho.update(data)
    return ho.hexdigest()