0
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.

ファイルのSHA-1ハッシュ値を計算する

0
Posted at

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

vbnet
Imports System.IO
Imports System.Security.Cryptography

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

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

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

1FA8AA8D779F4D707FBD01968595ED37E3A66E44
0
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
0
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?