cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lucian
Resolver I
Resolver I

Calculate MD5 hash for a text field similar to SQL HASHBYTES

Hello,

 

Is there a way to get an MD5 hash for a text field?

In SQL there is a way to convert a text to an MD5 hash using something like this:

 

 

SELECT CONVERT(VARCHAR(32), HASHBYTES('MD5',CONVERT(NVARCHAR(32),'abcd')),2) as HashString;

 

 

and the result would be "E4A5FC25F9BBE59EC5606FB8FC093C75"

 

How I could achieve the same result in Power Apps?

 

Kind Regards,

Lucian 

1 ACCEPTED SOLUTION

Accepted Solutions
Lucian
Resolver I
Resolver I

Hi @StalinPonnusamy 

The full working samples were posted by @ValentinGasenko and @maksii in two threads:

-one mentioned by you : https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Ability-to-create-an-MD5-hash/idi-p/43644

- second one with similar request/idea: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Function-to-encrypt-hash-sha512-sha1-sha256-MD5...

 

One is using "custom connector with Azure Functions", and the other is using "custom connector with the new Write Code" option.

 

Kind Regards,

Lucian

View solution in original post

9 REPLIES 9
StalinPonnusamy
Super User
Super User

Hi @Lucian

 

There is no functionality to convert a text to MD5 Power Automate or PowerApps.

 

Another option is to use a lightweight Azure function that converts and returns it. We can easily use it on Power Automate.

 

Note: I have done similar functionality using this same approach

 

This idea is already posted 

https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Ability-to-create-an-MD5-hash/idi-p/43644

StalinPonnusamy
Super User
Super User

Hi @Lucian 

 

Please let us know if anything needs on your post. We can help with this.

 

"Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful. "

 

 

Hi @StalinPonnusamy 

 

Thank you for your suggestion. I have found useful that idea, especially that "write code" option for custom connectors, and I hope the good guys from that thread - @ValentinGasenko and @maksii could provide a step by step using directly that option.

 

Kind Regards,

Lucian

Lucian
Resolver I
Resolver I

Hi @StalinPonnusamy 

The full working samples were posted by @ValentinGasenko and @maksii in two threads:

-one mentioned by you : https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Ability-to-create-an-MD5-hash/idi-p/43644

- second one with similar request/idea: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Function-to-encrypt-hash-sha512-sha1-sha256-MD5...

 

One is using "custom connector with Azure Functions", and the other is using "custom connector with the new Write Code" option.

 

Kind Regards,

Lucian

vgarcia
Advocate I
Advocate I

Hi!

 

First of all thanks for the incredible work behind this trick 😉

 

I just test it, but it doesn't work as I expected. In my case a need the MD5 of a JSON string. So when I sent the string to the connector, some characters change.

 

Example:

flow.png

Any idea to fix it?

Thx!

Hi @vgarcia ,

One idea to test is to base64 encode the JSON, then hash that encoded string.

Kind Regards,

Lucian

Hi @Lucian

 

I tested your idea and it works.

If someone have the samme issue, just made the following change, and send the string in BASE64.

Screenshot 2021-09-07 123849.png

 

Thx!

Lucian
Resolver I
Resolver I

Hi @vgarcia ,

Good to know it works that way either, but what I had in mind, was an step/action in Power Automate to convert the JSON to base64, then send that encoded string to the MD5 connector without modifying the code inside the connector. 😉

Kind Regards,

Lucian

Hi @Lucian 

I tested in this way, but the connector transform the base64 string so the md5 in the reply is different than the md5 of the original string.

BR

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,564)