[VB.Net] Hex->Binary Converter [Question] menu

User Tag List

Results 1 to 3 of 3
  1. #1
    d3rrial's Avatar Contributor Authenticator enabled
    Reputation
    127
    Join Date
    Apr 2010
    Posts
    527
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [VB.Net] Hex->Binary Converter [Question]

    Hey Guys: Wanted to ask you a simple question: I need a slice of code wich converts a Hex Value (a MD5 Hash) into a Binary Value. I cant get it to work >_<

    Code:
    Dim StringText As String = Hex(CInt(MD5StringHash(TextBox3.Text)))
    This is something I found on the Interwebz, but it doesnt work tho.

    [VB.Net] Hex-&gt;Binary Converter [Question]
  2. #2
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm assuming you have a function for MD5StringHash, yeah?

    The Hex function is used to change a normal int to a hex value. What you want there would be this:

    Code:
    Dim BinMD5 As String = Convert.ToString(Convert.ToInt32(MD5StringHash(TextBox3.Text),16),2)
    Breaking it down: You already have your MD5 string of Hex. The inner convert changes this to an int32 (from base 16). The outer changes this to binary (base 2). Convert = god when it comes to moving between arbitrary bases. ToInt32, you put what you're converting from. ToString, what you're converting to.

  3. #3
    d3rrial's Avatar Contributor Authenticator enabled
    Reputation
    127
    Join Date
    Apr 2010
    Posts
    527
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Idea sounded good, but the outcome was just another error.

    So I found a Solution by myself.

    Code:
        Public Function HexToBin(ByVal Übergabewert As Object) As String
            Dim abcdefg As Long
            Dim ausgabe As String = ""
            For abcdefg = 0 To 32 Step 1
                If ausgabe.length = 128 Then
                    Return ausgabe
                    Exit For
                Else
                    Select Case Übergabewert.Chars(abcdefg)
                        Case "0"
                            ausgabe = ausgabe & Format("0000", "0000")
                        Case "1"
                            ausgabe = ausgabe & Format("0000", "0001")
                        Case "2"
                            ausgabe = ausgabe & Format("0000", "0010")
                        Case "3"
                            ausgabe = ausgabe & Format("0000", "0011")
                        Case "4"
                            ausgabe = ausgabe & Format("0000", "0100")
                        Case "5"
                            ausgabe = ausgabe & Format("0000", "0101")
                        Case "6"
                            ausgabe = ausgabe & Format("0000", "0110")
                        Case "7"
                            ausgabe = ausgabe & Format("0000", "0111")
                        Case "8"
                            ausgabe = ausgabe & Format("0000", "1000")
                        Case "9"
                            ausgabe = ausgabe & Format("0000", "1001")
                        Case "A"
                            ausgabe = ausgabe & Format("0000", "1010")
                        Case "B"
                            ausgabe = ausgabe & Format("0000", "1011")
                        Case "C"
                            ausgabe = ausgabe & Format("0000", "1100")
                        Case "D"
                            ausgabe = ausgabe & Format("0000", "1101")
                        Case "E"
                            ausgabe = ausgabe & Format("0000", "1110")
                        Case "F"
                            ausgabe = ausgabe & Format("0000", "1111")
                    End Select
                End If
            Next
            Return ausgabe
        End Function
    Last edited by d3rrial; 04-20-2010 at 10:56 AM.

Similar Threads

  1. [Release] VB.Net / C# Hex-MD5 Hash to Binary!
    By d3rrial in forum Programming
    Replies: 2
    Last Post: 05-17-2010, 09:22 AM
  2. [Question] Hex Editing Continued?
    By Magichick in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 11-30-2007, 09:43 PM
  3. Question with HEX editing.
    By mathrine12345 in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 08-03-2007, 07:53 AM
  4. A question about converting
    By krazy12766 in forum World of Warcraft General
    Replies: 2
    Last Post: 08-22-2006, 08:02 PM
All times are GMT -5. The time now is 03:54 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search