# MD5 Hash String

**URL:** <https://forums.powershell.org/t/md5-hash-string/11312>\
**Category:** PowerShell Help\
**Created:** [September 14, 2018, 6:58am UTC](https://forums.powershell.org/t/md5-hash-string/11312 "2018-09-14T06:58:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![caditm](https://avatars.discourse-cdn.com/v4/letter/c/858c86/32.png) [@caditm](https://forums.powershell.org/u/caditm)\
**Post date:** [September 14, 2018, 6:58am UTC](https://forums.powershell.org/t/md5-hash-string/11312/1 "2018-09-14T06:58:43Z")

</div>

Hello

&nbsp;

We have a 3rd party product that generates PDF files, with filenames based on an md5 hash of the userid and some other information, essentially turning a 15 digit number into a hex string, followed by “.pdf”. This is done with the SQL Server hashbytes function, and we have been successful in terms of manipulating these files using SQL stored procedures. However, I would like to move this functionality (file & folder manipulation) from SQL over to PowerShell.

&nbsp;

Is there a recommended way to generate the md5 hash? Get-FileHash does the same thing for files, but I haven’t seen anything for string values, other than wrapping up the [HashAlgorithm](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.hashalgorithm?redirectedfrom=MSDN&view=netframework-4.7.2) class. Perhaps this is how it is “supposed” to be done, but I would like to use a PowerShell function if one is available, e.g.

```
Get-Hash -String “12345” -Algorithm “md5”
```

&nbsp;

Thanks

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [September 14, 2018, 10:16am UTC](https://forums.powershell.org/t/md5-hash-string/11312/2 "2018-09-14T10:16:50Z")

</div>

Unfortunately, There are no built0in cmdlet to do this. However PSXC module is having one with your expectation.

> **[Josep - Get-Hash, a powershell hash function](http://dbadailystuff.com/2013/03/11/get-hash-a-powershell-hash-function)**
>
> Get-Hash, a powershell hash function

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/md5-hash-string/11312/3 "2024-05-16T20:34:25Z")

</div>

Closed on May 16, 2024, 8:34pm UTC


