0

I have a form on cloudpages, my question is if it is possible to be able to encode one of the fields in md5, to send it to the DE as subscriberkey.

I have tried javascript but I have problems because I cannot install the MD5 package to use it.

0

Based on their documentation


     Platform.Load('Core','1')

     var email = Request.GetFormField('NAME_OF_EMAIL_FIELD');
     var email_md5 = Platform.Function.MD5(email,"UTF-8");

     // ... insert into DE

Now MD5 is not the greatest as it's known that you can generate the same hash (although very unlikely). A more secure way would be to implement SHA256 with an SSJS/AMPScript mix.


     Platform.Load('Core','1')

     var email = Request.GetFormField('NAME_OF_EMAIL_FIELD');
     Platform.Function.TreatAsContent("%%[var @email_sha set @email_sha = SHA256('"+email+"','UTF-16')]%%");
     var email_sha = Variable.GetValue("@email_sha");


     // ... insert into DE

Note: I've done this in production before but my code here is untested as I'm writing this off the top of my head with their documentation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.