ethical.blue Magazine

// Cybersecurity clarified.

Hexadecimal Speech (+Generator in C#.NET)

2022-04-13   Dawid Farbaniec
...
Sally (Artificial Intelligence)

Introduction

A hexadecimal number system to write numbers uses digits from 0 to 9 and letters from A to F. This is sixteen characters. I do not know who, but someone was so brilliant that he came up with this collection of characters to create words. Some readers may have met in the code or somewhere else values like this: 0xDEADBEEF, 0xDEADC0DE, 0x00000BAD or other. These presented words are numerical values ​​written in the hexadecimal system (also called hex). In these numbers we see English words: DEADC0DE » Dead Code or DEADBEEF » Dead Beef. When it comes to using these values, it looks cool and they are used to mark different places in the code. Such values will be quickly caught by the eye when analyzing the program in debugger and observing the values ​​of processor registers. This gives a clear signal for programmer / researcher.

Hex Speech Generator in C#.NET

Wondering what interesting words you can come up with a hexadecimal speech fell into my mind to write a generator of possible words.
// See https://aka.ms/new-console-template for more information

string inputPath = @"C:\Users\x\Desktop\hex-speech\wordlist.txt";
string outputPath = @"C:\Users\x\Desktop\hex-speech\zz.txt";

var lines = File.ReadAllLines(inputPath).ToList();
var filtered = new List<string>();

char[] validChars = new char[]
{
    'a', 'b', 'c', 'd', 'e', 'f', 'o', 'i', 't'
};

Dictionary<char, char> replaceChars = new ()
{
    { 'o' , '0'}, { 'i' , '1'}, { 't' , '7'}, { 's', '5' }
};

foreach (var line in lines)
{
    foreach (var ch in line.ToLower())
    {
        if (validChars.Contains(ch) == false)
            goto _skipline;
    }
    string formattedline = line;

    foreach (var rch in replaceChars.Keys)
    {
        formattedline = formattedline.Replace(rch, replaceChars[rch]);
    }

    filtered.Add("0x" + formattedline.ToUpper());
_skipline:
    continue;
}

File.WriteAllLines(outputPath, filtered);

Some Sample Words in Hex Speech

The above program generated about 300 words. Of course, it depends on the dictionary used and the program configuration.

I like the following words the most and I will probably will use them. 😁

0xAC1D – Acid (pol. kwas)
0xADD – Add (pol. dodawanie)
0xADD1C7ED – Addicted (pol. uzależniony)
0xAFFEC7ED – Affected (pol. dotknięty, zajęty np. affected terrain)
0xBAD – Bad (pol. zły)
0xBA0BAB – Baobab (pol. to chyba takie drzewo?)
0xBEEF – Beef (pol. wołowina)
0xB0B – Bob (pol. takie imię)
0xCAFE – Cafe (pol. kawiarnia)
0xC0C0A – Cocoa (pol. kokos)
0xC0DE – Code (pol. kod)
0xC0FFEE – Coffee (pol. kawa)
0xDEAD – Dead (pol. martwy)
0xDEAF – Deaf (pol. głuchy)
0xDEC0DE – Decode (pol. rozkodować)
0xDEFACED – Defaced (pol. oszpecony)
0xD1ABE71C – Diabetic (pol. cukrzycowy, diabetyk)
0xF00D – Food (pol. jedzenie)
0x1DEA – Idea (pol. pomysł)
0x70BACC0 – Tobacco (pol. tytoń)
0x70FFEE – Toffee (pol. tofi)

Thank you for the time given to reading this text.

Bibliography

//old archives