Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you should distinguish between two types of users:</p> <p>1) users that have logged in via Google Accounts or that have already registered on your site with a non-google e-mail address</p> <p>2) users that opened your site for the first time and are not logged in in any way</p> <p>For the second case, I can see no other way than to generate some random string (e.g. via <code>uuid.uuid4()</code> or from this user's session cookie key), as an anonymous user does not carry any unique information with himself.</p> <p>For users that are logged in, however, you already have a unique identifier -- their e-mail address. I agree with your privacy concerns -- you shouldn't use it as an identifier. Instead, how about generating a string that <em>seems</em> random, but is in fact generated from the e-mail address? Hashing functions are perfect for this purpose. Example:</p> <pre><code>&gt;&gt;&gt; import hashlib &gt;&gt;&gt; email = 'user@host.com' &gt;&gt;&gt; salt = 'SomeLongStringThatWillBeAppendedToEachEmail' &gt;&gt;&gt; key = hashlib.sha1('%s$%s' % (email, salt)).hexdigest() &gt;&gt;&gt; print key f6cd3459f9a39c97635c652884b3e328f05be0f7 </code></pre> <p>As <code>hashlib.sha1</code> is not a random function, but for given data returns always the same result, but it is proven to be practically irreversible, you can safely present the hashed key on the website without compromising user's e-mail address. Also, you can safely assume that no two hashes of distinct e-mails will be the same (they can be, but probability of it happening is very, very small). For more information on hashing functions, consult <a href="http://en.wikipedia.org/wiki/Cryptographic_hash_function" rel="nofollow noreferrer">the Wikipedia entry</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload