Discord Server Red Security Twitter Donation to Red Security Red Security Youtube Channel Red Security Tumblr Profile
Login or Register to Hide ads and Accessing all features on the forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image hasher vb.net
md5 image hasher

take the memory value of php and add a hash string
Imports System.IO
Imports System.Security
Imports System.Security.Cryptography

Public Class Form1

#Region "Raccourcis pour la fonction principale hash_generator"

   Function md5_hash(ByVal file_name As String)

       Return hash_generator("md5", file_name)

   End Function

   Function sha_1(ByVal file_name As String)

       Return hash_generator("sha1", file_name)

   End Function

   Function sha_256(ByVal file_name As String)

       Return hash_generator("sha256", file_name)

   End Function

#End Region

   Function hash_generator(ByVal hash_type As String, ByVal file_name As String)

       Dim hash
       If hash_type.ToLower = "md5" Then
           hash = MD5.Create
       ElseIf hash_type.ToLower = "sha1" Then
           hash = SHA1.Create()
       ElseIf hash_type.ToLower = "sha256" Then
           hash = SHA256.Create()
           MsgBox("Type de hash inconnu : " & hash_type, MsgBoxStyle.Critical)
           Return False
       End If

       Dim hashValue() As Byte

       Dim fileStream As FileStream = File.OpenRead(file_name)
       fileStream.Position = 0
       hashValue = hash.ComputeHash(fileStream)
       Dim hash_hex = PrintByteArray(hashValue)


       Return hash_hex

   End Function

   Public Function PrintByteArray(ByVal array() As Byte)

       Dim hex_value As String = ""

       Dim i As Integer
       For i = 0 To array.Length - 1

           hex_value += array(i).ToString("X2")

       Next i

       Return hex_value.ToLower

   End Function

   Private Sub BT_Parcourir_Click(sender As System.Object, e As System.EventArgs) Handles BT_Parcourir.Click

       If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

           Dim path As String = OpenFileDialog1.FileName
           TB_path.Text = path

           LB_md5.Text = md5_hash(path)
           LB_sha1.Text = sha_1(path)
           LB_sha256.Text = sha_256(path)

       End If

   End Sub

   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

   End Sub
End Class
Thank you bro, Will save this as well.
* Thankful to Allah *

Possibly Related Threads…
Thread Author Replies Views Last Post
  vb.net image url grabber viruss 0 160 08-31-2020, 01:44 PM
Last Post: viruss
  virus image browser download viruss 2 1,042 06-06-2018, 10:03 AM
Last Post: Mr.Kurd

Users browsing this thread: 1 Guest(s)