JSFiddle - React, Tailwind, and code Playground

by Lachlan Arthur

HTML

<script src="http://leemon.com/crypto/BigInt.js"></script>

JavaScript

var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop'.split('');
var alphabet_conv = {};
for (var i = 0; i < alphabet.length; i++) {
    alphabet_conv[alphabet[i]] = i;
}

function getWord(word) {
    word = word.split('');
    for (var i = 0; i < word.length; i++) {
        word[i] = alphabet_conv[word[i]];
    }
    return word;
}

function findWords(obj, length) {
    var word = str2bigInt('0',52,0);
    var wordList = [];
    do {
        var tempWord = getWord(bigInt2str(word, 52));
        if (obj[tempWord] != undefined) {
            wordList.push(tempWord);
        }
        console.log(bigInt2str(word, 52), tempWord);
        word = add(word,int2bigInt(1,52,0));
    } while (getWord(bigInt2str(word, 52)).length <= length);
    return wordList;
}

console.log(findWords(screen,1));