bruter
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    Brute force algorithm via js generator

    Install

    npm install bruter

    Usage

    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
    	}
    }

    Keywords

    none

    Install

    npm i bruter

    DownloadsWeekly Downloads

    0

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    4.71 kB

    Total Files

    6

    Last publish

    Collaborators

    • ym-project