mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Added Tool-Function to get Sha1 from String elements
This commit is contained in:
parent
d3c6255896
commit
f0b86ec346
1 changed files with 17 additions and 0 deletions
17
lib/core/tools/Get-StringSha1.psm1
Normal file
17
lib/core/tools/Get-StringSha1.psm1
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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;
|
||||
}
|
||||
Loading…
Reference in a new issue