Thread: MD5 Scan

Results 1 to 6 of 6
  1. #1
    fvestrgenrl's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Posts
    172
    Reputation
    9
    Thanks
    26

    MD5 Scan

    I want to scan for a select list of MD5 checksums, and if found, delete the file. how would i go about doing this? i have absolutely no idea S:
    edit: I mean like scanning a computer for files with md5 checksums, like a virus scanner scanning for the md5 checksums of known viruses.
    Last edited by fvestrgenrl; 11-28-2010 at 02:41 PM.
    Quote Originally Posted by fallon View Post
    hi i have make a hack and with hot keys but when i start it combat arms close down


    i use this code



    Code:
    PushToConsole("SkelModelStencil (V_F9)1");
    PushToConsole("ShowFps (V_INSERT");
    PushToConsole("ActivationDistance 999999(V_F6)" );
    PushToConsole("DisableCrosshair (V_NUMPAD 1" );
    PushToConsole("CrossHairR 255(V_NUMPAD 2) ");
    PushToConsole("ReloadSpeed 0.000000(V_F5) ");
    }
    Learning C++
    Pg 33/1225
    2.7%

  2. #2
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    [php]Imports System.Security.Cryptography
    Imports System.Text
    Imports System.IO

    Public Function MD5FileHash(ByVal sFile As String) As String
    Dim MD5 As New MD5CryptoServiceProvider
    Dim Hash As Byte()
    Dim Result As String = ""
    Dim Tmp As String = ""

    Dim FN As New FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
    MD5.ComputeHash(FN)
    FN.Close()

    Hash = MD5.Hash
    For i As Integer = 0 To Hash.Length - 1
    Tmp = Hex(Hash(i))
    If Len(Tmp) = 1 Then Tmp = "0" & Tmp
    Result += Tmp
    Next
    Return Result
    End Function[/php]

    I don't understand your question.



  3. #3
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    We don't flame a lot in the programming section unless you are really an arse and you're denying it, don't worry.

    Although some more information towards what you want accomplished would be fine. I'm not sure exactly what you want done.

  4. #4
    wtfiwantthatname's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    260
    Reputation
    10
    Thanks
    39
    My Mood
    Bored
    I guess he wants to make a duplicate finder. Using the files md5 to determine if two files are duplicates.
    "I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

  5. The Following User Says Thank You to wtfiwantthatname For This Useful Post:

    Hassan (11-28-2010)

  6. #5
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Here we go. Correct any errors as necessary. Just wrote it on MPGH post reply, so yeahs. C# and Visual Basic versions provided.

    You will need to put your MD5 hashes which you want to check against in an array, either hard coded or loaded from a file or from a website or however you want into a string[] called "MD5Hashes". You can change the variable names if you wish.

    C#
    Code:
    string MD5file(string fileName)
    {
      FileStream file = new FileStream(fileName, FileMode.Open);
      MD5 md5 = new MD5CryptoServiceProvider();
      byte[] retVal = md5.ComputeHash(file);
      file.Close();
     
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < retVal.Length; i++)
      {
        sb.Append(retVal[i].ToString("x2"));
      }
      return sb.ToString();
    }
    
    int main()
    {
    	string[] filePaths = Directory.GetFiles(@"C:\freedompeace");
    	foreach (string file in filePaths)
    	{
    		foreach (string MD5hash in MD5Hashes)
    		{
    			if (MD5file(file) == MD5hash)
    			{
    				File.Delete(file);
    			}
    		}
    	}
    }
    Visual Basic
    Code:
    Private Function MD5file(fileName As String) As String
    	Dim file As New FileStream(fileName, FileMode.Open)
    	Dim md5 As MD5 = New MD5CryptoServiceProvider()
    	Dim retVal As Byte() = md5.ComputeHash(file)
    	file.Close()
    
    	Dim sb As New StringBuilder()
    	For i As Integer = 0 To retVal.Length - 1
    		sb.Append(retVal(i).ToString("x2"))
    	Next
    	Return sb.ToString()
    End Function
    
    Private Function main() As Integer
    	Dim filePaths As String() = Directory.GetFiles("C:\freedompeace")
    	For Each file__1 As String In filePaths
    		For Each MD5hash As String In MD5Hashes
    			If MD5file(file__1) = MD5hash Then
    				File.Delete(file__1)
    			End If
    		Next
    	Next
    End Function

  7. The Following User Says Thank You to freedompeace For This Useful Post:

    kiraf4 (12-15-2010)

  8. #6
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Why are you posting code in c#? No1 really needs that here...



  9. The Following 2 Users Say Thank You to Blubb1337 For This Useful Post:

    Hassan (11-29-2010),Lolland (11-29-2010)