Compare commits
2 Commits
3ef80383ea
...
169faeed17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
169faeed17 | ||
|
|
ec08f9c95e |
@@ -1,5 +1,6 @@
|
||||
Imports System.IO
|
||||
Imports System.Security.Cryptography
|
||||
Imports System.Text
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
@@ -77,9 +78,7 @@ Public Class File
|
||||
Using oFileStream = IO.File.OpenRead(FilePath)
|
||||
Using oStream As New BufferedStream(oFileStream, 1200000)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oStream)
|
||||
Return BitConverter.
|
||||
ToString(oChecksum).
|
||||
Replace("-", String.Empty)
|
||||
Return FormatHash(oChecksum)
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
@@ -88,6 +87,18 @@ Public Class File
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetChecksumFromString(pStringToCheck As String) As String
|
||||
Dim oBytes() As Byte = Encoding.UTF8.GetBytes(pStringToCheck)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oBytes)
|
||||
Return FormatHash(oChecksum)
|
||||
End Function
|
||||
|
||||
Private Function FormatHash(pChecksum)
|
||||
Return BitConverter.
|
||||
ToString(pChecksum).
|
||||
Replace("-", String.Empty)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Adds file version string to given filename `Destination` if that file already exists.
|
||||
''' </summary>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.5.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.5.0")>
|
||||
<Assembly: AssemblyVersion("1.0.6.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.6.0")>
|
||||
|
||||
Reference in New Issue
Block a user