Created
May 26, 2015 08:04
-
-
Save kventil/cdd1054f51465c3b52b6 to your computer and use it in GitHub Desktop.
get md5-hash (Supports filesize > 2GB but is very slow!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function md5hash($path) | |
{ | |
$fullPath = Resolve-Path $path | |
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$file = [System.IO.File]::Open($fullPath,[System.IO.Filemode]::Open, [System.IO.FileAccess]::Read) | |
[System.BitConverter]::ToString($md5.ComputeHash($file)) | |
$file.Dispose() | |
} | |
md5hash($args[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should be noted that you could also swap the service provider in line 4 to one of the following. The interface is the same, so it should work right away: