import hashlib data = 123 md5 = hashlib.md5(data.encode(encoding='UTF-8')).hexdigest() print(md5) output: 202cb962ac59075b964b07152d234b70