Last active
March 12, 2021 20:02
-
-
Save Devetec/25f78f22f5637198547796503d5c4823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const _sodium = require('libsodium-wrappers'); | |
(async() => { | |
if (process.argv.length <= 2){ | |
console.log("Please enter a term to find, with an optional password, e.g. node vanity.js test [password]"); | |
return; | |
} | |
var match = process.argv[2]; | |
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
for(var i = 0; i < match.length; i++){ | |
if (ALPHABET.indexOf(match[i]) < 0){ | |
console.log("Your search term is not valid - please ensure search term only includes b58 valid characters: " + ALPHABET); | |
return; | |
} | |
} | |
await _sodium.ready; | |
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | |
var ee = require("./main.js"); | |
var eztz = ee.eztz; | |
eztz.library.sodium = _sodium; | |
var keys, fmatch = "tz1" + match; | |
console.log("Searching for " + fmatch); | |
var cc = 0; | |
function tick() { | |
m = eztz.crypto.generateMnemonic(); | |
if (process.argv.length > 2) { | |
keys = eztz.crypto.generateKeys(m, process.argv[3]); | |
} else { | |
keys = eztz.crypto.generateKeys(m); | |
} | |
if (keys.pkh.substr(0, fmatch.length) == fmatch){ | |
console.log("\nFound match:"); | |
console.log(keys.pkh); | |
console.log(m); | |
} else { | |
printProgress("Checked " + cc++ + " hashes"); | |
setImmediate(tick); | |
} | |
} | |
tick(); | |
})(); | |
function printProgress(progress){ | |
process.stdout.clearLine(); | |
process.stdout.cursorTo(0); | |
process.stdout.write(progress + "\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const _sodium = require('libsodium-wrappers'); | |
(async() => { | |
if (process.argv.length <= 2){ | |
console.log("Please enter a term to find, e.g. node index.js test"); | |
return; | |
} | |
var match = process.argv[2]; | |
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
for(var i = 0; i < match.length; i++){ | |
if (ALPHABET.indexOf(match[i]) < 0){ | |
console.log("Your search term is not valid - please ensure search term only includes b58 valid characters: " + ALPHABET); | |
return; | |
} | |
} | |
await _sodium.ready; | |
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | |
var ee = require("./main.js"); | |
var eztz = ee.eztz; | |
eztz.library.sodium = _sodium; | |
var keys, fmatch = "tz1" + match; | |
console.log("Searching for " + fmatch); | |
var cc = 0; | |
function tick() { | |
keys = eztz.crypto.generateKeysNoSeed(); | |
if (keys.pkh.substr(0, fmatch.length) == fmatch){ | |
console.log("\nFound match:"); | |
console.log(keys); | |
} else { | |
printProgress("Checked " + cc++ + " hashes"); | |
setImmediate(tick); | |
} | |
} | |
tick(); | |
})(); | |
function printProgress(progress){ | |
process.stdout.clearLine(); | |
process.stdout.cursorTo(0); | |
process.stdout.write(progress + "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment