import hashlib


def _username_hash(username):
  """Returns bytes, a cryptographically safe one-way hash of the username.

  This way, if someone breaks the Fernet encryption, they still don't know the
  username.

  Args:
    username: unicode
  """
  return hashlib.sha256(username.encode('utf-8')).digest()