mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Revised following comments from Chris Church.
Now uses sha1 checksums following merge of 9688. Also I undid the changes I made to fetch.py win_template.py now uses conn.shell.has_trailing_slash and conn.shell.join_path updated integration tests.
This commit is contained in:
parent
bf916fb58a
commit
e37b63386c
4 changed files with 12 additions and 12 deletions
|
@ -142,14 +142,14 @@ Function ConvertTo-Bool
|
|||
return
|
||||
}
|
||||
|
||||
# Helper function to calculate md5 of a file in a way which powershell 3
|
||||
# Helper function to calculate a hash of a file in a way which powershell 3
|
||||
# and above can handle:
|
||||
Function Get-FileMd5($path)
|
||||
Function Get-FileChecksum($path)
|
||||
{
|
||||
$hash = ""
|
||||
If (Test-Path -PathType Leaf $path)
|
||||
{
|
||||
$sp = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider;
|
||||
$sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider;
|
||||
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read);
|
||||
[System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
|
||||
$fp.Dispose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue