import hashlib def md5_encrypt(value): md5 = hashlib.md5() md5.update(value.encode('utf-8')) return md5.hexdigest()