Crate bitflip

Source
Expand description

Generates bitflips for byte and UTF-8 strings.

Each function returns an iterator that yields each possible output of flipping each bit in the input in turn. ascii_bytes and ascii_str essentially return 7 * input.len() permutations, bytes returns 8 * input.len(), and utf8 is… complicated.

A very simple example would be:

for s in bitflip::ascii_str("ab") {
    print!("{s} ");
}

Which outputs:

`b cb eb ib qb Ab !b ac a` af aj ar aB a"

This is inspired by — and essentially a direct Rust port of — the Python blip package by Zack Allen.

Structs§

ByteIterator
Iterator returned by functions that yield Vec<u8>.
StringIterator
Iterator returned by functions that yield String.

Functions§

ascii_bytes
Flips each bit within the ASCII byte string in turn.
ascii_str
Flips each bit within the ASCII string in turn.
bytes
Flips each bit within the given byte slice.
utf8
Flips each bit within the given string, then only returns those that are valid UTF-8 in their own right.