brute v0.1.0 Brute

Brute is a package that generates combinations of various characters.

For example, Brute can generate all of the combinations of the characters a b c using the following:

Brute.generic(?a..?c, 3)

Will generate aaa, aac, … , ccb, ccc (no order gurantee).

By providing a range, brute will generate all combinations from the specified lengths.

Brute.generic(?a..?c, 1..3)

Will generate something similar to the following: a, b , c, …, z, aa, ab, …, zy, zz, … aaa, aab, …, zzy, zzz

Since most functions in Brute return a stream, they can combined with other operations. For example, calculating a hash:

'abcdefghijkpqrstuvwxyzABCDEFGHIJKPQRSTUVWXYZ0123456789`~!@#$%^&*()_+{}:"<>?"`'
|> Brute.generic(1..20)
|> Stream.map(fn str ->
  :crypto.hash(:sha, str) |> Base.encode16
end)

Summary

Functions

Generates combinations for abcdefghijklmnopqrstuvwxyz specifined by n.

iex> Brute.alpha(1) |> Enum.to_list |> length
26

Returns a stream of character combinations of length low to high, by specifying low = 1, high = 3 with the character set of a b c the following stream will be returned

Functions

alpha(n)
alpha(pos_integer) :: Stream.t

Generates combinations for abcdefghijklmnopqrstuvwxyz specifined by n.

iex> Brute.alpha(1) |> Enum.to_list |> length
26
generic(characters, range)
generic(charlist, 1) :: Stream.t
generic(charlist, Range.t) :: Stream.t
generic(charlist, pos_integer) :: Stream.t

Returns a stream of character combinations of length low to high, by specifying low = 1, high = 3 with the character set of a b c the following stream will be returned:

a, b , c, …, z, aa, ab, …, zy, zz, … aaa, aab, …, zzy, zzz