![]() |
|
Violent's HWID Function - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: Violent's HWID Function (/Thread-Violent-s-HWID-Function) |
Violent's HWID Function - ViolentReality - 08-15-2013 Hey guys, so here's another useful bit of code that I dug out of my old laptop files. I declared HardwareMD5 globally in a Module. VB.NET Usage: Code: Dim HardwareMD5 As String = String.Empty
Dim MD5Hash As String = Functions.StringToMD5(Functions.StringToXOR(Functions.HardwareToString, "ThisIs16Chars123"))
HardwareMD5 = MD5HashSpoiler: Custom MD5 Encode Function:[code=vbnet]Public Function StringToMD5(ByVal Content As String) As String Dim MD5 As New System.Security.Cryptography.MD5CryptoServiceProvider Dim ByteObject() As Byte = System.Text.Encoding.ASCII.GetBytes(Content) ByteObject = MD5.ComputeHash(ByteObject) Dim FinalHash As String = Nothing For Each bt As Byte In ByteObject FinalHash &= bt.ToString("x2") Next Return FinalHash End Function[/code] Spoiler: Custom XOR Encryption Function:[code=vbnet]Public Function XORToString(ByVal Input As String, ByVal pass As String) As String Dim Output As New System.Text.StringBuilder Dim HASH As New System.Security.Cryptography.MD5CryptoServiceProvider Dim XORHash As Byte() = Hash.ComputeHash(System.Text.Encoding.ASCII.GetBytes(pass)) Dim u As Integer For i As Integer = 0 To Input.Length - 1 Step +2 Dim tmp As String = Chr(("&H" & Input.Substring(i, 2)) Xor XorHash(u)) Output.Append(tmp) If u = pass.Length - 1 Then u = 0 Else u = u + 1 Next Return Output.ToString End Function[/code] Spoiler: Custom XOR Decryption Function:[code=vbnet]Public Function StringToXOR(ByVal Input As String, ByVal pass As String) As String Dim Output As New System.Text.StringBuilder Dim HASH As New System.Security.Cryptography.MD5CryptoServiceProvider Dim XORHash As Byte() = HASH.ComputeHash(System.Text.Encoding.ASCII.GetBytes(pass)) Dim z As Integer For y As Integer = 0 To Input.Length - 1 Dim tmp As String = Hex(Asc(Input(y)) Xor XORHASH(z)) If tmp.Length = 1 Then tmp = "0" & tmp Output.Append(tmp) If z = pass.Length - 1 Then z = 0 Else z = z + 1 Next Return Output.ToString End Function[/code] Spoiler: Custom Hardware ID Function:[code=vbnet]'You will need to first go to the top of your code and type this without quotes: "Imports System.Management" 'You will then need to go to Project > Add Reference > .NET > System.Management Public Function HardwareToString() Dim Final As String = String.Empty Dim managementclass As New ManagementClass("win32_processor") Dim objectcollection As ManagementObjectCollection = managementclass.GetInstances() Final += DirectCast(objectcollection(0), ManagementObject).Properties("processorID").Value.ToString() + "|" Dim disk As New ManagementObject("win32_logicaldisk.deviceid=""" + Environment.SystemDirectory(0) + ":""") Final += disk("VolumeSerialNumber").ToString() Return Final End Function[/code] [ Download Source ] - All of the above. |