MD5 Hash String

Welcome Forums General PowerShell Q&A MD5 Hash String

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
2 months ago.

  • Author
    Posts
  • #111803

    Participant
    Points: 21
    Rank: Member

    Hello

     

    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"

     

    Thanks

  • #111811

    Participant
    Points: 527
    Helping Hand
    Rank: Major Contributor

    Unfortunately, There are no built0in cmdlet to do this. However PSXC module is having one with your expectation.
    http://dbadailystuff.com/2013/03/11/get-hash-a-powershell-hash-function

You must be logged in to reply to this topic.