import uuid import hashlib from script import base from django.conf import settings def encrypt(info): hash_object = hashlib.md5(settings.SECRET_KEY.encode("utf8")) hash_object.update(info.encode("utf8")) return hash_object.hexdigest() def uid(string): data = "{}-{}".format(uuid.uuid4(),string) return encrypt(data)