2013-04-23 18:51:17 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2012-10-17 04:07:35 +02:00
|
|
|
import hashlib
|
2013-04-23 18:51:17 +02:00
|
|
|
from zephyr.lib.utils import make_safe_digest
|
2012-10-17 04:07:35 +02:00
|
|
|
|
|
|
|
def gravatar_hash(email):
|
|
|
|
"""Compute the Gravatar hash for an email address."""
|
2013-03-20 15:31:27 +01:00
|
|
|
# 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)
|