JSFiddle - React, Tailwind, and code Playground

by Spencer Smith

HTML

<script src="https://unpkg.com/[email protected]/js/md5.js"></script>

JavaScript

console.log(md5);

const answer = '9ee5cd26d136bb18d228e3e4ea63610b';
console.log('answer:', answer);
// flag{ 2 letters 1 symbol 1 letter 1 symbol 1 digit }

const l = 'abcdefghijklmnopqrstuvwxyz';
const d = '0123456789';
const s = '!@#$%^&*()_+=-.,></?"\':;';

let count = 0;

const flag = bruteForce();
console.log('flag:', flag);
console.log('count:', count);

function bruteForce() {
  for (let l1 = 0; l1 < l.length; l1++) {
    for (let l2 = 0; l2 < l.length; l2++) {
      for (let s1 = 0; s1 < s.length; s1++) {
        for (let l3 = 0; l3 < l.length; l3++) {
          for (let s2 = 0; s2 < s.length; s2++) {
            for (let d1 = 0; d1 < d.length; d1++) {

              const flag = `flag{${l[l1]}${l[l2]}${s[s1]}${l[l3]}${s[s2]}${d[d1]}}`;
              const hash = md5(flag);
              // console.log('flag:', flag);
              // console.log('hash:', hash);

              if (hash === answer) {
                return flag;
              }
            }
          }
        }
      }
    }
  }
}