gdpr data-protection
Is hash of a username still personal data?
<p>I create a script, which asks a user who upload a GIF to a social media website, if it can reupload it to another website (to reduce other users' internet usage). Now I want to give users an option to save their consent for a longer time, so they don't need to click a link every time they upload a GIF. Users don't have a random ID, I only can use their usernames, which are surely personal data (many users use their Facebook account to create their account, and then their usernames are created from their first and last name). </p>

<p>So my question is - if I store <a href="https://en.wikipedia.org/wiki/Hash_function" rel="noreferrer">a <em>hash</em></a> of the usernames (irreversible form), is it still considered to be their personal data?</p>

<p>It depends on whether you can identify the person to whom a username hash belongs.</p>

<p>If you store both username and its hash in the same database row then yes.</p>

<p>If it is impracticable for you to identify the person by their hash only, then no.</p>

<p>This comes from the <a href="https://gdpr-info.eu/art-4-gdpr/" rel="noreferrer">definition</a> of personal data — "<em>any information relating to an identified or identifiable natural person</em>", and <a href="https://gdpr-info.eu/recitals/no-26/" rel="noreferrer">Recital 26: Not applicable to anonymous data</a>. The hash is essentially anonymous data <strong>when</strong> it does not on its own allow to identify the person (with reasonable efforts i.e. without spending $$$ on detectives or forensic science).</p>

<p>The <a href="https://en.wikipedia.org/wiki/Article_29_Data_Protection_Working_Party" rel="noreferrer">Art. 29 WP</a> has released <a href="https://ec.europa.eu/justice/article-29/documentation/opinion-recommendation/files/2014/wp216_en.pdf" rel="noreferrer">Opinion 05/2014 on Anonymisation Techniques</a>. There it defines a hash function like this:</p>

<blockquote>
  <p>Hash function: this corresponds to a function which returns a fixed size output from an input of any size (the input may be a single attribute or a set of attributes) and cannot be reversed; this means that the reversal risk seen with encryption no longer exists. However, if the range of input values the hash function are known they can be
  replayed through the hash function in order to derive the correct value for a particular record. For instance, if a dataset was pseudonymised by hashing the national identification number, then this can be derived simply by hashing all possible input values and comparing the result with those values in the dataset. Hash functions are usually designed to be relatively fast to compute, and are subject to brute force attacks. Pre-computed tables can also be created to allow for the bulk reversal of a large set of hash values.</p>
  
  <p>The use of a salted-hash function (where a random value, known as the “salt”, is added to the attribute being hashed) can reduce the likelihood of deriving the input value but nevertheless, calculating the original attribute value hidden behind the result of a salted hash function may still be feasible with reasonable means.</p>
</blockquote>

<p>So a hash function is considered pseudonymisation, not anonymisation. Pseudonymised data is still personal data. See also <a href="https://gdpr-info.eu/art-4-gdpr/" rel="noreferrer">art.4 GDPR</a> which contains definitions of ‘personal data’ and ‘pseudonymisation’.</p>

<p>In your question you say you want to give users an option to save their consent for a longer time. So you use a hash to identify such a user. That implies that you are able to identify a user, so it is personal data. That does not mean your processing is unlawful. If you make it clear to users you save their consent when they select that option, they implicitly also give consent to the saving itself, so <a href="https://gdpr-info.eu/art-6-gdpr/" rel="noreferrer">art. 6(1)(a)</a> applies. But also <a href="https://gdpr-info.eu/art-6-gdpr/" rel="noreferrer">art. 6(1)(b)</a> would probably apply.</p>

<p><a href="https://gdpr-info.eu/art-25-gdpr/" rel="noreferrer">Art. 25</a> and <a href="https://gdpr-info.eu/art-32-gdpr/" rel="noreferrer">Art. 32</a> encourage the use of pseudonymisation when processing personal data. </p>

<p>The above would only apply if the hash function generates a unique hash for each input. If you use a hash function where different inputs generate the same hash, it would not be considered aggregation (or generalization). Art. 29 WP has also written about that in their <a href="https://ec.europa.eu/justice/article-29/documentation/opinion-recommendation/files/2014/wp216_en.pdf" rel="noreferrer">Opinion 05/2014 on Anonymisation Techniques</a>. See the topic on "Aggregation and K-anonymity" (3.2.1). So even aggregation does not allow effective anonymisation in all cases.</p>
