JSFiddle - React, Tailwind, and code Playground
by fairmutex
HTML
<div class="leftcolumn" style="margin-left: 25px;">
<h1>Konnekt Developer Challenge</h1>
<p>The Instructions are hidden in the <em>source</em><p><p>There are 5 rows and 32 columns. Make use of a <em>[5,15][3, 8]S</em> algorithm with mode ECB. Oh, and you will need a key, try GetKey with a certain binary parameter!</p><div style="font-family: monospace;font-size:1.5em; letter-spacing:1em"><p>45265383c6eb81489a1a5590131e2c24</p><p>75e572daebd601c4691b56eb2a6bff96</p><p>0361361e130cc95034c2e834aff66797</p><p>63616eaabda69e0186a6f2030781c7b5</p><p>6f12e75d19c50bd5b36c184ebd1188ec</p></div>
</div>
</div>
<script type="text/javascript">
document.write("Give it a try. We’re warning you, it’s {01100100 01100001 01101101 01101110 00100000 01100101 01100001 01110011 01111001}."+"<br /><br />")
document.write("bin2txt on \"01100100 01100001 01101101 01101110 00100000 01100101 01100001 01110011 01111001\" = "+bin2txt("01100100 01100001 01101101 01101110 00100000 01100101 01100001 01110011 01111001")+"<br /><br />");
document.write("bin2txt on \"01000111 01101111\" = "+bin2txt("01000111 01101111")+"<br /><br />");
document.write("GetKey on \"0100011101101111\" = "+GetKey("0100011101101111")+"<br /><br />");
function bin2txt(bin) {
var res = bin.replace(/ /g,"").replace(/[01]{8}/g, function(v) {
return String.fromCharCode( parseInt(v,2) );
});
return res;
}
function GetKey(bin) {
var asciiToUse = [111, 114, 105, 103, 97, 109, 105]
if (!bin) {
return "Ohh.. use a certain binary parameter";
}
if (typeof bin === "string") {
var strarr = bin.match(/.{1,8}/g);
var asciiarr = [];
var ansofbin = "";
var ret = ""
for (var i in strarr) {
asciiarr.push(parseInt(strarr[i], 2))
}
for (var i in asciiarr) {
ansofbin +=...