[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 851
  • Last Modified:

Getting MD5 Hash Of File in SSIS

I need to get the Hash of the files content. I know SSIS gets the checksum for every row in the file. But what I need to get is the Hash of the content of the file. So, when I insert a log of the file processed and can insert the FileName and its hash (content of the file).

This will help me when I re-run the package and this package read the same filename, I calculate the hash of the content and then I compare this hash vs. the one that storage in the log table, so if the hash is the same I wont process anything, but if the hash is different I will process the file.

Anyone has experience with this?

Thank you
0
visibleworld
Asked:
visibleworld
1 Solution
 
Bob LearnedCommented:
I don't have a lot of experience with SSIS, and code, but here is the code that I use to calculate an MD5 hash for a password.


Imports System.Text.Encoding
Imports System.Security.Cryptography

Public Class Md5Hash

    Public Function Compute(ByVal password As String) As String

        Dim providerHash As New MD5CryptoServiceProvider

        Dim plainBytes() As Byte = UTF8.GetBytes(password)

        Dim hashBytes() As Byte = providerHash.ComputeHash(plainBytes)

        Dim computedHash As String = BitConverter.ToString(hashBytes).Replace("-"c, String.Empty)

        Return computedHash

    End Function

End Class

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now