Discord Server Twitter Donation Youtube Google+
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image hasher vb.net
#1
md5 image hasher

take the memory value of php and add a hash string
Code:
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()
       Else
           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)

       fileStream.Close()

       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
[img=0x0]https://hackmyass.files.wordpress.com/2011/01/hackers.jpg[/img]
Reply
#2
Thank you bro, Will save this as well.

[Image: 4Kxb0N1.gif]
We Are Anonymous, We Are Legion, We Do not Forgive, We do not Forget
Expect Us
Reply




Users browsing this thread: 2 Guest(s)