Skip to content

Instantly share code, notes, and snippets.

@juananpe
Created Jul 25, 2022
Embed
What would you like to do?
HackIt 2022 / Level 1 / level.js
let init = "pruebaprueba14";
let val = [...init]
let a=[];
let tmp;
for (let i = 0; i <= 13; i++){
a[i] = val[i].charCodeAt(0);
}
for (let j = 1; j <= 42 ; j++){
for (let i = 0; i <= 13; i++) {
a[i] = ( a[i] + j * a[ (i + 1) % 14 ] ) % 256
}
tmp = a[1]
a[1] = a[2]
a[2] = tmp
a[3] = (a[3] * 49) % 256
a[4] = (a[4] * ((j * 2) + 1)) % 256
a[5] = 255 - a[5]
tmp = a[0]
for (let i = 0; i<= 12; i++){
a[i] = a[i + 1]
}
a[13] = tmp
console.log(j, a)
}
s = a.toString() + ","
console.log(s)
if (s != "101,107,164,102,76,232,0,57,122,139,112,36,17,205,"){
console.log( "Wrong!" )
}else{
console.log("Nice!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment