cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lucian
Advocate II
Advocate II

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
Advocate II
Advocate II

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
Advocate II
Advocate II

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

vgarcia
Frequent Visitor

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

vgarcia
Frequent Visitor

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
Advocate II
Advocate II

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

vgarcia
Frequent Visitor

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,005)