Mr. Mxyzinjin's Brain



    The code starts by creating an empty string for the password. It then loops through the string "0123456789", looking for a number that is three digits long. It saves the number in w for later. Next, it calculates the time it took to convert the number to a string using process.hrtime() and stores that in t. Finally, it compares the password stored in pw to the numbers in timing.sort() and If the password matches one of the numbers in timing, it returns that number.

    function crack(login) {
      var pw = '';
      while(true) {
        var cands = [...'0123456789'];
        while(cands.length>1) {
          var timing =>[s,0]);
          for(var r=0; r<3; r++) {
            for(var i=0; i<cands.length; i++) {
              var w = pw+cands[i];
              var t = process.hrtime();
              if(login(w)) return w;
              var s = process.hrtime(t);
          cands = timing.sort((a,b)=>b[1]-a[1]).slice(0,timing.length/2|0).map(e=>e[0]);
        pw += cands[0];
        if(pw.length>32) pw='';
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.