#NAME: Get-SHA1HashFromString.ps1 # #DESCRIPTION: Return a SHA1 Hash from a String. # #USER PARAMETERS: $string as String # #REVISIONS # #DATE DEVELOPER DESCRIPTION OF REVISION VERSION #========= =============== ================================= =========== #06192008 Ivo Looser Initial release 1.00 param( [string] $string = {throw("Please define a String.")} ) $encoding = new-object System.Text.ASCIIEncoding $byteArrayOne = ([byte[]]$encoding.GetBytes($string)) $engine = new-object System.Security.Cryptography.SHA1CryptoServiceProvider $byteArrayTwo = [byte[]]$engine.ComputeHash([byte[]]$byteArrayOne) return $([System.Convert]::ToBase64String($byteArrayTwo))