mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
See PEP 328[1] for details. This feature was introduced in Python 2.5 and will become mandatory in Python 3. [1]: http://www.python.org/dev/peps/pep-0328 (imported from commit 7444eeba8a08d5f91b94c7921848f2274979bd76)
14 lines
582 B
Python
14 lines
582 B
Python
from __future__ import absolute_import
|
|
|
|
import hashlib
|
|
from zephyr.lib.utils import make_safe_digest
|
|
|
|
def gravatar_hash(email):
|
|
"""Compute the Gravatar hash for an email address."""
|
|
# Non-ASCII characters aren't permitted by the currently active e-mail
|
|
# RFCs. However, the IETF has published https://tools.ietf.org/html/rfc4952,
|
|
# outlining internationalization of email addresses, and regardless if we
|
|
# typo an address or someone manages to give us a non-ASCII address, let's
|
|
# not error out on it.
|
|
return make_safe_digest(email.lower(), hashlib.md5)
|