Site icon R-bloggers

SHA256

[This article was first published on Keyword Hero – The SEO Revolution, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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“)

Der Beitrag SHA256 erschien zuerst auf Keyword Hero – The SEO Revolution.

To leave a comment for the author, please follow the link and comment on their blog: Keyword Hero – The SEO Revolution.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.