mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
18 lines
441 B
PowerShell
18 lines
441 B
PowerShell
|
|
function Get-StringSha1()
|
||
|
|
{
|
||
|
|
param(
|
||
|
|
[string]$Content
|
||
|
|
);
|
||
|
|
|
||
|
|
$CryptoAlgorithm = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider;
|
||
|
|
$ContentHash = [System.Text.Encoding]::UTF8.GetBytes($Content);
|
||
|
|
$ContentBytes = $CryptoAlgorithm.ComputeHash($ContentHash);
|
||
|
|
$OutputHash = '';
|
||
|
|
|
||
|
|
foreach($byte in $ContentBytes) {
|
||
|
|
$OutputHash += $byte.ToString()
|
||
|
|
}
|
||
|
|
|
||
|
|
return $OutputHash;
|
||
|
|
}
|