Skip to content

Instantly share code, notes, and snippets.

@IngwiePhoenix
Created February 25, 2020 22:32
Show Gist options
  • Save IngwiePhoenix/501942963259da21def4a6fe0cc1f36a to your computer and use it in GitHub Desktop.
Save IngwiePhoenix/501942963259da21def4a6fe0cc1f36a to your computer and use it in GitHub Desktop.
AEW's "cryptic" Dark Order message - decrypted. (Although...not that hard.)

AEW Cryptic Tweet translation

The following files all contain material used for conversion. I was bored so I wrote this tiny program as a way to warm up before working on some PHP and Laravel stuff.

I used NodeJS. The code is provided below.

If you want the output, scroll to the last file at the bottom.

Tested on NodeJS 13.9.0!

Thanks for reading! :)

Challenge

Feel bored? Optimize my code! :)

Find me

Twitter: @IngwiePhoenix

# Copy-typed off the WhatCulture #ThisIsTheNews evening video,
# which showed the tweet: https://www.youtube.com/watch?v=dliynTh6CfI
01001010 01000100 01001111
01001111 01000001 01010010
01001001 01010010 01000100
01001110 01001011 01000101
01010010
const {readFileSync, existsSync} = require("fs");
const {fromCodePoint} = String;
const {argv} = process;
const {error, log} = console;
const {write} = process.stdout;
if(argv.length != 3) {
error("Please supply the input file.");
}
const filename = argv[2];
if(!existsSync(filename)) {
error(`File "${filename}" not found!`);
}
let contents = readFileSync(filename).toString("utf8");
// Although I have sanity checks above, I am only going to ignore comments,
// and not make any further checks. This is just a silly little tool anyway.
let lines = contents.split("\n");
lines.forEach(line => {
if(line.trim().startsWith("#")) return;
/*
Because I am lazy, I am going to artificially pad a space here to make the loop
below actually print out the third found set of digits in ASCII.
There are highly likly better methods to do so but it's 11.19pm and...well, this
is not a serious program at all.
So f*ck it, I'll cheat. xD
*/
let chars = (line+" ").split("");
let bin = "";
let newLine = [];
let skipCount = 0;
let seenNumbersYet = false;
for(let i in chars) {
let char = chars[i]; // Nope, not gonna do .hasOwnProperty, cuz im lazy.
if(char == "0" || char == "1") {
bin += char;
seenNumbersYet = true;
} else if(char == " " && seenNumbersYet) {
newLine.push(fromCodePoint(parseInt(bin, 2)));
bin = "";
} else if(char == " " && !seenNumbersYet) {
skipCount++;
}
}
// Number.times() isn't exactly a method so...
for(var j = ((skipCount - (skipCount % 8)) / 8); j != 0; j--) {
newLine.unshift(" ");
}
log(newLine.join(" "));
});
> node .\aew-decrypt.js .\aew-msg.txt
J D O
O A R
I R D
N K E
R
@IngwiePhoenix
Copy link
Author

@andersevenrud You sure enjoy that little challenge. :p Glad to learn something new! This sure looks waaaaaay better than my initial approach. Almost makes me feel like a "script kiddy" in comparsion... xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment