Leaving The 8-bit World

--

We still kinda live in an 8-bit world. Our computer systems grew from simple terminals which could only show a limited set of characters. These typically supported ASCII characters and only eight bits long and focused on a US viewpoint of the world (‘a’-’z’,”A’-’Z’, ‘$’ and so on). In ASCII, an ‘a’ is 0x61 in hexadecimal, and 0110 0001 in binary.

But there’s a whole world of characters out there, and UTF-8 and UTF-16 open up a new world of character sets. For this, we can use Unicode, which allows us to support different character sets. Some examples are [here]:

Thus, a hex value which defines the code. For example, U+2800 to U+28FF give us Braille patterns [here]:

We can list some of the Unicode characters here:

To support this in a Web page, we need to add UTF-8 support:

<head>
<meta charset="UTF-8">
</head>

So, let’s create a Web page with these Braille codes. In C# we can take a word and then convert to Unicode with:

    public static string getBraille(string s)
{
s = s.ToLower();
string rtn = "";



string[] mapping = { "&#x2801;", "&#x2803;", "&#x2809;", "&#x2819;",
"&#x2811;", "&#x280B;", "&#x281B;", "&#x2813;", "&#x280A;",
"&#x281A;", "&#x2805;", "&#x2807;", "&#x280D;", "&#x281D;", "&#x2815;", "&#x280F;","&#x281F;", "&#x2817;",
"&#x280e;", "&#x281E;",
"&#x2825;", "&#x2827;",
"&#x283a;", "&#x282d;", "&#x283d;", "&#x2835;" };
foreach (char ch in s )
{
int val = ((int)ch - (int)'a');
try
{

if (ch==' ') rtn = rtn + "&#x2800;"+" ";
else rtn = rtn + mapping[val];

}
catch (Exception ex) { }

}
return (rtn);

}

In this case, the unicode for an ‘a’ in Braille is U+2801, and so we can use the HTML tag of “&#x2801;”. We can then integrate this into our code with:

   string message = "abc";

string s = getBraille(message);


ViewData["message"] = message;

string cryptedPassword = "<table><tr><td><div>Bob has left a secret message for Alice (see below). Can you find the message?</div></td></tr><tr><td><div><p style='font-size:70px; '>" + getBraille(message) + " </p></div></td></tr><tr><td><p style='font-size:20px;'><img src='/content/br.png' width='600px'/></td></tr></table>";


ViewData["c"] = cryptedPassword;

A sample is [here]:

You can try this out here:

https://asecuritysite.com/ctf/ctf_braille

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.