Source code for threeML.utils.unique_deterministic_tag

import hashlib


[docs] def get_unique_deterministic_tag(string): """Return a hex string with a one to one correspondence with the given string. :param string: a string :return: a hex unique digest """ try: return hashlib.md5(string.encode("utf-8")).hexdigest() except AttributeError: # onyl instance when ther above will fail is when string is not a str return hashlib.md5(string).hexdigest()