Skip to content

Instantly share code, notes, and snippets.

@CrimsonMaple
Created Feb 26, 2018
Embed
What would you like to do?
NoSource JR + NoSource Solve
var enc_key_jr = "nosource"; // -> "easyctf{" -> "soupy"
var enc_key = "heheheh!"; // -> "easyctf{" -> "hoo_hoo!"
var flag_nosource_jr = "Fg4GCRoHCQ4TFh0IBxENAE4qEgwHMBsfDiwJRQImHV8GQAwBDEYvV11BCA==";
var flag_nosource = "DQ4cJgsbCVofB18sNw4wRlhfCwAbXxpTC1wwKVlcGBIaUDAGJzowYDoqTiI=";
function process(a, b) {
'use strict';
var len = Math.max(a.length, b.length);
var out = [];
for (var i = 0, ca, cb; i < len; i++) {
ca = a.charCodeAt(i % a.length);
cb = b.charCodeAt(i % b.length);
out.push(ca ^ cb);
}
return String.fromCharCode.apply(null, out);
}
function dec_flag(flag, boolean) {
flag_tmp = atob(flag);
if (boolean == 0)
console.log(process(flag_tmp, enc_key_jr));
else
console.log(process(flag_tmp, enc_key))
}
dec_flag(flag_nosource_jr, 0);
dec_flag(flag_nosource, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment