Click here to Skip to main content
16,010,650 members
Home / Discussions / C#
   

C#

 
AnswerRe: Decoding Hex to String [modified] Pin
stancrm13-Jul-06 3:18
stancrm13-Jul-06 3:18 
GeneralRe: Decoding Hex to String Pin
MrEyes13-Jul-06 3:21
MrEyes13-Jul-06 3:21 
GeneralRe: Decoding Hex to String Pin
stancrm13-Jul-06 3:26
stancrm13-Jul-06 3:26 
GeneralRe: Decoding Hex to String Pin
MrEyes13-Jul-06 3:37
MrEyes13-Jul-06 3:37 
AnswerRe: Decoding Hex to String Pin
Sean Michael Murphy13-Jul-06 3:40
Sean Michael Murphy13-Jul-06 3:40 
GeneralRe: Decoding Hex to String Pin
MrEyes13-Jul-06 3:52
MrEyes13-Jul-06 3:52 
GeneralRe: Decoding Hex to String Pin
Ravi Bhavnani13-Jul-06 4:49
professionalRavi Bhavnani13-Jul-06 4:49 
GeneralRe: Decoding Hex to String Pin
BoneSoft13-Jul-06 6:32
BoneSoft13-Jul-06 6:32 
Sean Michael Murphy wrote:
(char)byte.Parse(hex.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)


Damn, I didn't know you could do that... I was doing it the hard way

public string DecryptHexString(string text) {
    string output = string.Empty;

    for (int i = 0; i < text.Length; i += 2) {
        int hval = DeHex(text.Substring(i, 2));
        int temp = (hval ^ (output.Length + 1) % 256);
        output += (char)temp;
    }
    return output;
}

private int DeHex(string input) {
    int val;
    int result = 0;
    for (int i = 0; i < input.Length; i++) {
        string chunk = input.Substring(i, 1).ToUpper();
        switch (chunk) {
            case "A":
                val = 10; break;
            case "B":
                val = 11; break;
            case "C":
                val = 12; break;
            case "D":
                val = 13; break;
            case "E":
                val = 14; break;
            case "F":
                val = 15; break;
            default:
                val = int.Parse(chunk); break;        
        }
        if (i == 0) {
            result += val * 16;
        } else {
            result += val;
        }
    }
    return result;
}




Try code model generation tools at BoneSoft.com.
QuestionDeleting Excel menus Pin
snwborder2813-Jul-06 2:23
snwborder2813-Jul-06 2:23 
AnswerRe: Deleting Excel menus Pin
Paul Conrad21-Jul-06 7:05
professionalPaul Conrad21-Jul-06 7:05 
QuestionInteractive Services in .NET 2.0 Pin
Waqas Nasir13-Jul-06 2:08
Waqas Nasir13-Jul-06 2:08 
AnswerRe: Interactive Services in .NET 2.0 Pin
Dave Kreskowiak13-Jul-06 6:56
mveDave Kreskowiak13-Jul-06 6:56 
QuestionGet a Label Caption from anotehr process! Pin
suguimoto13-Jul-06 1:50
suguimoto13-Jul-06 1:50 
AnswerRe: Get a Label Caption from anotehr process! Pin
Dave Kreskowiak13-Jul-06 6:53
mveDave Kreskowiak13-Jul-06 6:53 
GeneralRe: Get a Label Caption from anotehr process! Pin
suguimoto13-Jul-06 20:15
suguimoto13-Jul-06 20:15 
Questionwant create Custom control just like MessageBox Pin
indiaone13-Jul-06 1:26
indiaone13-Jul-06 1:26 
AnswerRe: want create Custom control just like MessageBox Pin
Roger Alsing13-Jul-06 1:38
Roger Alsing13-Jul-06 1:38 
GeneralRe: want create Custom control just like MessageBox Pin
indiaone13-Jul-06 1:47
indiaone13-Jul-06 1:47 
AnswerRe: want create Custom control just like MessageBox Pin
Ravi Bhavnani13-Jul-06 2:45
professionalRavi Bhavnani13-Jul-06 2:45 
QuestionCommand, Immediate window Pin
SysJey13-Jul-06 1:24
SysJey13-Jul-06 1:24 
AnswerRe: Command, Immediate window Pin
Ed.Poore15-Jul-06 12:59
Ed.Poore15-Jul-06 12:59 
QuestionWhats the best method to read the text value out of a specific XML element Pin
Red_Wizard_Shot_The_Food13-Jul-06 1:14
Red_Wizard_Shot_The_Food13-Jul-06 1:14 
AnswerRe: Whats the best method to read the text value out of a specific XML element Pin
stancrm13-Jul-06 1:32
stancrm13-Jul-06 1:32 
GeneralRe: Whats the best method to read the text value out of a specific XML element Pin
Red_Wizard_Shot_The_Food13-Jul-06 1:40
Red_Wizard_Shot_The_Food13-Jul-06 1:40 
GeneralRe: Whats the best method to read the text value out of a specific XML element Pin
stancrm13-Jul-06 1:49
stancrm13-Jul-06 1:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.