tgoal.html - hashcrush - Compute Argon2id hashes
 (HTM) git clone git://git.z3bra.org/hashcrush.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
       tgoal.html (4468B)
       ---
            1 <!DOCTYPE HTML>
            2 <html>
            3 <head>
            4         <meta charset="utf-8">
            5         <meta name="author" content="z3bra">
            6         <meta name="viewport" content="width=device-width">
            7         <link rel="icon" type="image/gif" href="miner.gif" />
            8         <title>🎉 Hashing Party</title>
            9         <style type="text/css"><!--
           10         body { max-width:540px;margin:auto;padding:1em;}
           11         h1, h2, pre#list {text-align:center;}
           12         details, p {margin:1em auto;text-align:left;}
           13         pre {overflow:scroll;}
           14         #progress {width:80%;margin:auto;background-color:lightgrey;}
           15         #bar {height:2em;background-color:#2baf12;}
           16         @media (prefers-color-scheme: dark) {
           17         body { background-color: #1E1F21; color: #EEEFF1; }
           18         #progress {background-color:#3E3F41;}
           19         a { color: #BAD7FF; }
           20 }
           21 --></style>
           22 </head>
           23 <body>
           24 
           25 <h1 id=goal>Road to 3Gib!!</h1>
           26 <h2 id=size></h1>
           27 <div id="progress"><div id="bar"></div></div>
           28 <details open><summary>What's that?</summary>
           29 <p>
           30 I'm working on a CTF-like challenge for which I need to generate a database
           31 filled with random passwords and their corresponding argon2id hash.<br>
           32 Because argon2 is specifically made to take a long time to compute,
           33 my computers couldn't reach this goal in a reasonable amount of time.
           34 This website <strike>is</strike> was a call for help.
           35 </p>
           36 </details>
           37 <details><summary>You're cracking a database right?</summary>
           38 <p><b>No</b>.</p>
           39 <p>
           40 I know it sounds shady, but I do not need any specific password or salt,
           41 which this project generates randomly
           42 (see <a href="https://git.z3bra.org/hashcrush/file/tools/diceware.html#l22">here</a>,
           43 <a href="https://git.z3bra.org/hashcrush/file/hashgen/hashgen.go.html#l97">here</a>
           44 and <a href="https://git.z3bra.org/hashcrush/file/tools/hashdump.html#l7">there</a>),
           45 which would make the computed hashes way too random to be any useful as
           46 a real-world password cracking database.
           47 </p>
           48 </details>
           49 <details><summary>How do I help?</summary>
           50 <p>
           51 We reached the 3 Gib milestone on august 18<sup>th</sup> 2023.
           52 To this day, I do not need any more hashes. This project and the data are now in the public domain, so anyone can experiment with it. To compute your own records, follow the instructions below:
           53 <p>
           54 Clone the repository, and start crushing hashes! (<em>timeout at your discretion</em>)
           55 <pre>
           56 git clone git://git.z3bra.org/<a href='https://git.z3bra.org/hashcrush'>hashcrush.git</a>
           57 timeout 3h make -C hashcrush
           58 </pre>
           59 <p>
           60 Thanks!
           61 </p>
           62 </details>
           63 
           64 <pre id=list></pre>
           65 
           66 <script type='text/javascript'>
           67 /*
           68  * Assumes "baseurl" provides directory listing for all the *.rec files
           69  */
           70 var baseurl = "https://pub.z3bra.org/hashcrush/";
           71 var goal = 3221225472; // goal line
           72 var avg  = 132;        // average record size
           73 
           74 function getsize(url) {
           75         var r = new XMLHttpRequest();
           76         r.open("HEAD", url, false);
           77         r.send(null);
           78         return Number(r.getResponseHeader('content-length'));
           79 }
           80 
           81 function human(bytes, si=false, dp=1) {
           82   const thresh = si ? 1000 : 1024;
           83   if (Math.abs(bytes) < thresh) {
           84     return bytes + ' B';
           85   }
           86   const units = si 
           87     ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] 
           88     : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
           89   let u = -1;
           90   const r = 10**dp;
           91   do {
           92     bytes /= thresh;
           93     ++u;
           94   } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
           95   return bytes.toFixed(dp) + ' ' + units[u];
           96 }
           97 
           98 var http = new XMLHttpRequest();
           99 http.open("GET", baseurl, false);
          100 http.send(null);
          101 var doc = new DOMParser().parseFromString(http.response, "text/html");
          102 var pad = (document.documentElement.clientWidth) > 540 ? 44 : 24;
          103 
          104 var sz = 0;
          105 var pre = `\nfile ${"hash".padStart(pad-4)} ${"size".padStart(pad/2)}\n\n`;
          106 
          107 var a = doc.getElementsByTagName('a');
          108 for (i=0; i < a.length; i++) {
          109         if (a[i].innerText.match(/\.rec$/)) {
          110                 var asz = getsize(baseurl + a[i].innerText);
          111                 var href = a[i].innerText;
          112                 sz += asz;
          113 
          114                 // append record metadata to the page
          115                 // hash count is a rough estimate based on filesize
          116                 var c = Math.floor(asz / (avg*1000))
          117                 var n = (c > 999) ? Math.floor(c/1000) + "M" : c + "K";
          118                 var hsz = human(asz).padStart(pad/2, ' ');;
          119                 var hct = n.padStart(pad - href.length, ' ');
          120                 pre += `<a href=${href}>${href}</a> ${hct} ${hsz}\n`;
          121         }
          122 }
          123 
          124 document.getElementById('size').innerHTML = human(sz) + " / " + Math.ceil(sz / 132) + " hashes";
          125 document.getElementById('list').innerHTML = pre; 
          126 document.getElementById('goal').innerText = "Congratulation!";
          127 document.getElementById("bar").style.width = Math.min(100, Math.floor(sz*100/goal)) + "%";
          128 </script>
          129 </body>
          130 </html>