Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Edit</strong> (now that I've done the math)</p> <p>There are around 6*10^36 possible combinations you'll need to iterate through - the largest <code>long</code> value is about 9*10^18 - a <em>much</em> smaller number. </p> <p>That being said, say you find an optimized way to iterate over the combinations where you can generate and compare a trillion (10^12) combinations per second (<em>much</em> faster than your average developer's machine), and you can parallelize it across a million machines - that would be (60*60*24*365*10^12)*10^6 per year, or about 3*10^25 combinations checked per year.</p> <p>At that blazing speed, <strong>it would still take ~190 billion years to go over all combinations.</strong> </p> <p>I strongly urge you to investigate another alternative for achieving your goal instead of trying every single key.</p> <p>Now (back to my original answer), if you had a reasonably sized subset of keys you wanted to iterate over, I could imagine doing something like this with a straight up number loop that just converted the number to a modified base-26 for the key.</p> <p>Some pseudo-code:</p> <pre><code>public void runAlgorithm () { for (int i=startKey; i&lt;endKey; i++) { String key = toBase26(i); testKey(key); } } </code></pre> <p>Use something like <a href="http://en.wikipedia.org/wiki/Hexavigesimal" rel="nofollow">this hexavigesimal converter from wikipedia</a> for the impl of <code>toBase26</code> (copied below):</p> <pre><code>public static String toBase26(int number){ number = Math.abs(number); String converted = ""; // Repeatedly divide the number by 26 and convert the // remainder into the appropriate letter. do { int remainder = number % 26; converted = (char)(remainder + 'A') + converted; number = (number - remainder) / 26; } while (number &gt; 0); return converted; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload