2.0.0 • Published 5 years ago
bruter v2.0.0
Brute force algorithm via js generator
Install
npm install bruterUsage
Basic example
const bruteForce = require('bruter')
const alphabet = 'abc'
for (const chars of bruteForce({alphabet})) {
	console.log(chars)
	if (chars === 'aba') {
		break
	}
}Continue from certain position
const bruteForce = require('bruter')
const alphabet = 'abc'
const from = 5
for (const chars of bruteForce({
	alphabet,
	from,
})) {
	console.log(chars)
	if (chars === 'aba') {
		break
	}
}Brute in some range
It's useful to brute via several nodes parallel.
const bruteForce = require('bruter')
const alphabet = 'abc'
const from = 5
const to = 10
for (const chars of bruteForce({
	alphabet,
	from,
	to,
})) {
	console.log(chars)
	if (chars === 'aba') {
		break
	}
}2.0.0
5 years ago