Pages

Monday, March 3, 2014

Encoding and Decoding Hexadecimal Messages



There I was, minding my own business, when all of the sudden my eyes settled upon this unintelligible string of 2-digit hexadecimal numbers.

"22 48 61 76 65 20 79 6f 75 20 67 6f 74 20 77 68 61 74 20 69 74 20 74 61 6b 65 73 3f 22"

Naturally, I interpreted the string as an encrypted challenge issued to me personally by some NSA cyber spy who was probably watching me, evaluating my reaction, timing my response, and judging my fitness for survival in the Digital Age.

I might just survive to encrypt and decrypt another day. Here is how I cracked the code:

1. I  typed the code into Google and found that it shows up in the banner of the CyberSentinal newsletter.

2. Unfortunately, I have not yet mastered JavaScript, C, Perl, or Python, so at present I do not have the skill to convert the hex to ASCII using a program such as this Java routine I found online at StackOverflow.com.

public static void main(String[] args) {
    String hex = "224861766520796f7520676f7420776861742069742074616b65733f22";
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < hex.length(); i+=2) {
        String str = hex.substring(i, i+2);
        output.append((char)Integer.parseInt(str, 16));
    }
    System.out.println(output);
}

3. The (moderately) good news is that (a) I can recognize hexadecimal and (b) I know how to spell ASCII. So I looked around for (i.e., Googled) some online tools to convert hex to ASCII with no programming required. The one from string-functions.com worked admirably.

The Answer to the Question is a Question: "Have you got what it takes?"

My Answer to the Question is a Statement: "Fake it till you make it!"

Or, as we say in Cyber Patrol,

"46 61 6b 65 20 69 74 20 74 69 6c 6c 20 79 6f 75 20 6d 61 6b 65 20 69 74 21."



No comments:

Post a Comment