Using SHA256 to hash email addresses

If you upload your users’ email addresses to Facebook or AdWords, you should hash them to conform and abide by all data privacy and protection rules.

Uploading them to these two marketing systems requires the SHA-256 hash algorithm, other algorithms do not work as your users will not be matched with their corresponding profiles.

 

Hashing addresses using online tools

There are a few tools on the internet, that do the hashing for you. We can recommend http://hashgenerator.de/, where you can use other algorithms, too.

However, using online tools, you’ll be sharing potentially valuable and maybe even protected data with a third party. Most larger companies will not allow their employees in the first place and require you to do it locally.

 

Hashing emails using R

We suggest using the statistical programming language R to hash data. It’ll hash even large files easily and is the Swiss army knife when it comes to handling data. Below you find a script that will make R Studio hash your users’ mails:

##Script to hash email addresses using a SHA-256 hash algorithm########################################################################################################

#importing mails: C:/Users/User/Desktop/my_mails.csv in the script with the
#save all mails in .csv file. You’ll load the data into and edit it with your R console.
#replace C:/Users/User/Desktop/my_mails.csv in the code with the path of your .csv file.
my_mails <- read.table(„C:/Users/User/Desktop/my_mails.csv“, quote=“\““, comment.char=““)
#download digest
install.packages(„digest“)
library(digest)
for (i in 1:nrow(my_mails)){
x[[,i]]<-(digest(my_mails[i,], algo=c(„sha256“)))
}
my_hashed_mails<-as.matrix(x)
#Saving the mails in a .csv file. You can use this file to to upload the mails into AdWords, Facebook, etc.
write.csv(my_hashed_mails, "my_hashed_mails.csv“)