Filesystem: Add GetChecksum
This commit is contained in:
parent
ed2c785580
commit
75b789ded8
@ -1,4 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports System.Security.Cryptography
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
@ -65,6 +66,14 @@ Public Class File
|
||||
Return oCleanName
|
||||
End Function
|
||||
|
||||
Public Function GetChecksum(FilePath As String) As String
|
||||
Using oStream As New BufferedStream(IO.File.OpenRead(FilePath), 1200000)
|
||||
Dim oSHA As New SHA256Managed()
|
||||
Dim oChecksum() As Byte = oSHA.ComputeHash(oStream)
|
||||
Return BitConverter.ToString(oChecksum).Replace("-", String.Empty)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Adds fileversions to given filename `Destination` if that file already exists.
|
||||
''' </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user