Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
8793308c
Commit
8793308c
authored
Jul 14, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made md5 into generic checksum function that uses sha now
parent
6376dda5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lib/ansible/module_utils/powershell.ps1
+3
-3
No files found.
lib/ansible/module_utils/powershell.ps1
View file @
8793308c
...
...
@@ -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-File
Md5
(
$path
)
Function
Get-File
Checksum
(
$path
)
{
$hash
=
""
If
(
Test-Path
-PathType Leaf
$path
)
{
$sp
=
new-object
-TypeName System.Security.Cryptography.
MD5
CryptoServiceProvider;
$sp
=
new-object
-TypeName System.Security.Cryptography.
SHA1
CryptoServiceProvider;
$fp
=
[
System.IO.File]::Open
(
$path
,
[
System.IO.Filemode]::Open,
[
System.IO.FileAccess]::Read
)
;
$hash
=
[
System.BitConverter]::ToString
(
$sp
.ComputeHash
(
$fp
))
.Replace
(
"-"
,
""
)
.ToLower
()
;
$fp
.Dispose
()
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment