loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.661490215552859","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"bGV0IG1lc3NhZ2UgPSAiSSBCIEMgQSBSIEwgQSBNIFQgQSBSIEcgQyBFIFMgVCBBIEMgTSBIIE8gVyBBIEEiOw0KDQpjb25zdCBkZWNyeXB0U2ltcGxlID0gKG1zZywga2V5KSA9PiB7DQoJbGV0IHJlcyA9ICIiOw0KICBjb25zdCBtc2dBcnIgPSBtc2cuc3BsaXQoJyAnKTsNCiAgaWYobXNnQXJyLmxlbmd0aCAlIGtleSAhPT0gMCl7DQogIAlyZXR1cm4gIkludmFsaWQgTWVzc2FnZSEiDQogIH0NCiAgbGV0IGNvbEFyciA9IFtdOw0KICBsZXQgb2Zmc2V0ID0gMDsNCiAgd2hpbGUob2Zmc2V0IDwgbXNnQXJyLmxlbmd0aCAvIGtleSkgew0KICAgIGxldCBjb2wgPSBbXTsNCiAgICBmb3IobGV0IGkgPSBvZmZzZXQ7IGkgPCBtc2dBcnIubGVuZ3RoOyBpICs9IChtc2dBcnIubGVuZ3RoIC8ga2V5KSl7DQogICAgICBjb2wucHVzaChtc2dBcnJbaV0pOw0KICAgIH0NCiAgICBjb2xBcnIucHVzaChjb2wpOw0KICAgIG9mZnNldCsrOw0KICB9DQogIA0KICBsZXQgbW92ZURvd24gPSB0cnVlOw0KICBsZXQgaiA9IDA7DQogIGZvcihsZXQgaSA9IDA7IGkgPCBjb2xBcnIubGVuZ3RoOyBpKyspew0KICAgIHJlcyArPSBjb2xBcnJbaV1bal07DQogICAgaWYoaiA9PT0gMCl7DQogICAgICBtb3ZlRG93biA9IHRydWU7DQogICAgfQ0KICAgIGlmKGogPT09IChrZXkgLSAxKSl7DQogICAgICBtb3ZlRG93biA9IGZhbHNlOw0KICAgIH0NCiAgICBtb3ZlRG93biA/IGorKyA6IGotLTsNCiAgfQ0KICANCiAgcmV0dXJuIHJlczsNCn0NCg0KZGVjcnlwdFNpbXBsZShtZXNzYWdlLCAzKTs="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let message = "I B C A R L A M T A R G C E S T A C M H O W A A";

const decryptSimple = (msg, key) => {
	let res = "";
  const msgArr = msg.split(' ');
  if(msgArr.length % key !== 0){
  	return "Invalid Message!"
  }
  let colArr = [];
  let offset = 0;
  while(offset < msgArr.length / key) {
    let col = [];
    for(let i = offset; i < msgArr.length; i += (msgArr.length / key)){
      col.push(msgArr[i]);
    }
    colArr.push(col);
    offset++;
  }
  
  let moveDown = true;
  let j = 0;
  for(let i = 0; i < colArr.length; i++){
    res += colArr[i][j];
    if(j === 0){
      moveDown = true;
    }
    if(j === (key - 1)){
      moveDown = false;
    }
    moveDown ? j++ : j--;
  }
  
  return res;
}

decryptSimple(message, 3);
node v10.16.0