Open scott-cuna opened 11 months ago
// https://github.com/stewartlord/identicon.js/blob/4fad7cafec1b7a4d896015e084e861625ef5d64f/identicon.js#L80 // 11111 00100 00100 // getIdenticon("skotz-", "101101011111111", 1000000) // code = 15 character string representing 25 pixel image // 1 = solid, 0 = white // 10 05 00 05 10 // 11 06 01 06 11 // 12 07 02 07 12 // 13 08 03 08 13 // 14 09 04 09 14 var getIdenticon = function (base, code, attempts = 1000000) { var best = 0; var bestName = ""; for (var j = 0; j < attempts; j++) { var name = base + Math.random().toString().replace("0.", ""); var hash = sha256(name); var sim = 0; for (i = 0; i < 15; i++) { var color = parseInt(hash.charAt(i), 16) % 2 ? 0 : 1; if (color == code[i]) { sim++; } } if (sim > best) { best = sim; bestName = name; } if (sim >= 15) { console.log("iterations: " + j); console.log("username: " + bestName); return; } } }; getIdenticon("skotz-", "101101011111111")
hidden feature activatable via console