Method: Specinfra::Command::Windows::Base::File.get_md5sum

Defined in:
lib/specinfra/command/windows/base/file.rb

.get_md5sum(file) ⇒ Object


49
50
51
52
53
54
55
# File 'lib/specinfra/command/windows/base/file.rb', line 49

def get_md5sum(file)
  <<-EOT
  $md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
  $sum = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes("#{file}")))
  echo $sum.ToLower().Replace("-","")
  EOT
end