File size: 294 Bytes
e0fcef4
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
"""data handling helpers"""

import hashlib


def md5(to_hash: str, encoding: str = "utf-8") -> str:
    try:
        return hashlib.md5(to_hash.encode(encoding), usedforsecurity=False).hexdigest()
    except TypeError:
        return hashlib.md5(to_hash.encode(encoding)).hexdigest()  # nosec