SHA-256 an email address Link in Velocity

Highlighted
Level 2

SHA-256 an email address Link in Velocity

Hi,

I am working with Conversant to add in parameters, they have asked if hasing is possible with Marketo, as below - 

  • The dtm_email_hash parameter (dtm_email_hash={{lead.Email Address}}) should be encrypted using SHA256 hashing as that is personal information. Is this possible with market?

Is it possible to SHA256 Hashing an email address in an link?

Thanks,

Haroon

27 REPLIES 27
Highlighted
Level 10 - Community Moderator

Re: SHA-256 an email address Link in Velocity

I assume your search found https://nation.marketo.com/community/product_and_support/blog/2018/07/17/sha-256-ing-an-email-addres... and you're wondering if it still works that simply?

Unfortunately, after June 2019 it's not that simple. It would now have to be written in "pure" Velocity, like my Base64 routinehttps://nation.marketo.com/community/product_and_support/blog/2019/10/13/base64-ing-a-string-in-velo... So the answer is: absolutely, it can be done by a skilled Velocity developer. But there's no built-in function for it.

Alternately, you could call a webhook-compatible service (not calling it at send time, but rather when the email address is created/changed) to compute the pre-SHA'd email address and store it in another field. For a slowly-changing field like the email this would work fine.

Highlighted
Level 2

Re: SHA-256 an email address Link in Velocity

Thanks Sanford!

Is there any webhook-compatible service you know of? Would help me look into it a little more.

Highlighted
Level 10 - Community Moderator

Re: SHA-256 an email address Link in Velocity

Is there any webhook-compatible service you know of?

Yes... but Community Guidelines prohibit mentioning it.

If I were in your shoes I'd build it in Velocity, knowing it can be done. But obvs. that's easy for me to say.

Highlighted
Level 2

Re: SHA-256 an email address Link in Velocity

Thanks again

Any chance you can provide an example or velocity code I can look at to build this?

Highlighted
Level 10 - Community Moderator

Re: SHA-256 an email address Link in Velocity

My Base64 code is the closest you're going to get to this kind of algorithm. (Though obvs. a different algo.)

Highlighted
Level 2

Re: SHA-256 an email address Link in Velocity

Cool, is this the code? https://nation.marketo.com/community/product_and_support/blog/2019/10/13/base64-ing-a-string-in-velo... 

I'll see if I can manage to do something.

Highlighted
Level 7

Re: SHA-256 an email address Link in Velocity

Is there any webhook-compatible service you know of?

You can DIY with a server and a custom field. e.g.

<?php
echo json_encode(['response'=>hash( "sha256" , $_POST['email'] )]);
?>
‍‍‍

map response to your custom field

Highlighted
Level 2

Re: SHA-256 an email address Link in Velocity

Hi Jay,

Thanks for that, not sure how to go about with PHP with Marketo, new to this.

Will it be possible to give some more guidance?

Thanks!

Highlighted
Level 7

Re: SHA-256 an email address Link in Velocity

1. Create a php file with the above code on your server

1.1 if you don't have a custom field already, create a custom string field to save your hash of the email address

2. Create the Marketo webhook

pastedImage_1.png

3. Map the response

pastedImage_2.png

4. Create your smart campaign

pastedImage_3.png

flow:

pastedImage_4.png