Skip to content

Commit ce0d04d

Browse files
author
Horacio Fernandez
committed
Merge pull request #18 from horacio3/dev
Adding hash functions
2 parents c0437de + 6d47c36 commit ce0d04d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

rsCommon.psm1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,31 @@ Function Unlock-Credentials
515515
}
516516
}
517517
return $credHT
518+
}
519+
Function Test-rsHash
520+
{
521+
param (
522+
[String] $file,
523+
[String] $hash
524+
)
525+
if ( !(Test-Path $hash) ){
526+
return $false
527+
}
528+
if( (Get-FileHash $file).hash -eq (Import-Csv $hash).hash){
529+
return $true
530+
}
531+
if( (Get-FileHash $file).hash -eq (Import-Csv $hash)){
532+
return $true
533+
}
534+
else {
535+
return $false
536+
}
537+
}
538+
Function Set-rsHash
539+
{
540+
param (
541+
[String] $file,
542+
[String] $hash
543+
)
544+
Set-Content -Path $hash -Value (Get-FileHash -Path $file | ConvertTo-Csv)
518545
}

0 commit comments

Comments
 (0)