2

I'd like to encrypt email address in a data extension with SHA256 within marketing cloud. This will be used as a unique identifier.

  1. When the email goes into a data extension, have the email address in one column but in another column, have the SHA256 encryption generated.
  2. Once it's there, update all subscribers attribute with this encryption.
  3. Keep this constant for every subscriber that goes into the data extension.

I'm trying to get some ideas on where to start. Would ssjs be my best option or sql?

2
  • Are you saying you want to use the SHA256 encryption version of the email address as the contact / subscriber key? Jun 1, 2018 at 0:38
  • Hi @TravisNaughton I still want subscriber key to be unique to the platform but I want an additional unique identifier for each subscriber. This way, if we encrypt outside of sfmc the encryption will be the same. Currently, I'm working with ssjs + ampscript (my sfmc instance doesn't seem to allow this though) or seeing if I can use hashbytes as well.
    – tmy144
    Jun 1, 2018 at 12:46

1 Answer 1

4

Little late on the answer but I've been working on this recently and someone might find this information useful.

If you are looking to do an encryption on data once it is inside Marketing Cloud the 2 main ways to do this would be with SQL activity or script activity.

SSJS only support MD5 hashes so this is fairly limiting. AMPscript does have more support for SHA256 but as you noted in the question you cannot use SSJS + AMPscript in an Automation Studio activity.

With SQL activity you can use the HASHBYTES function, making sure you cast and convert the values in the right way. This could be run on a schedule.

CONVERT(NVARCHAR(MAX), 
HASHBYTES('SHA2_256', CAST('hellowworld' as varchar(350))),
2) as EncryptedValue

To update the All Subscribers attributes typically an export, transfer and import activity to the All Subscribers list via csv is common practice.

4
  • Thanks Travis! I appreciate you answering but I was able to figure this out.
    – tmy144
    Oct 31, 2018 at 15:28
  • meant to finish my comment -- I wasn't able to use hashbytes but I was able to figure this out. 1) ampscript via a content block 2) populate ssjs 3) set the automation to run.
    – tmy144
    Oct 31, 2018 at 15:34
  • Ah nice! I always forget about that option. Oct 31, 2018 at 22:24
  • AND CONVERT(NVARCHAR(MAX), HASHBYTES('SHA2_256', CAST(A.PersonEmail as varchar(350))), 2) IN ( Select email FROM IGO_PROFILES where Value_1 <> '' ) // Above gives me zero outcome, IGO_PROFILES has Sha256 encrypted emailadresses without a key, purely Sha256 injected from GTM. What do i need to change to compare the two strings.
    – RobSource
    Nov 16, 2021 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .