1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ファイルのMD5ハッシュ値を計算する

Last updated at Posted at 2014-05-06

ファイルとデータ ストリームの読み取りと暗号サービスのクラスを使用します。

vbnet
Imports System.IO
Imports System.Security.Cryptography

MD5.ComputeHashメソッドにファイルの内容を入力し、結果を整形します。

vbnet
Dim md5HashAlgorithm As MD5 = MD5.Create()
Dim path As String = "filename.ext"
Using stream As Stream = File.OpenRead(path)
    Console.WriteLine(String.Concat(md5HashAlgorithm.ComputeHash(stream).Select(Function(x) String.Format("{0:X2}", x))))
End Using

結果は次のようになります。

823CC703C3D49CF68F7D3C3FE7E32FBF
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?