-
-
Save juananpe/39a5379b68cea022bcac2815c131e078 to your computer and use it in GitHub Desktop.
HackIt 2022 / Level 1 / level.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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