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.
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 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”