playbook/antigravity-awesome-skills/skills/loki-mode/benchmarks/results/2026-01-05-00-49-17/humaneval-solutions/162.py

11 lines
367 B
Python

def string_to_md5(text):
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'
"""
if text == '':
return None
import hashlib
return hashlib.new("md5", text.encode(), usedforsecurity=False).hexdigest()