ROSE
0.11.22.0
|
Combinatoric functions.
Classes | |
class | Hasher |
Hash interface. More... | |
class | HasherFnv |
Fowler-Noll-Vo hashing using the Hasher interface. More... | |
class | HasherGcrypt |
Hasher for any libgcrypt hash algorithm. More... | |
class | HasherSha256Builtin |
Built-in SHA-256 hasher. More... | |
Typedefs | |
typedef HasherGcrypt< 0 > | HasherMd5 |
MD5 hasher. More... | |
typedef HasherGcrypt< 0 > | HasherSha1 |
SHA1 hasher. More... | |
typedef HasherGcrypt< 0 > | HasherSha256 |
SHA-256 hasher. More... | |
typedef HasherGcrypt< 0 > | HasherSha384 |
SHA-384 hasher. More... | |
typedef HasherGcrypt< 0 > | HasherSha512 |
SHA-512 hasher. More... | |
typedef HasherGcrypt< 0 > | HasherCrc32 |
ISO 3309 hasher. More... | |
Functions | |
ROSE_DLL_API bool | flip_coin () |
Simulate flipping a coin. More... | |
template<typename T > | |
void | shuffle (std::vector< T > &vector, size_t nitems=UNLIMITED, size_t limit=UNLIMITED) |
Shuffle the values of a vector. More... | |
ROSE_DLL_API std::vector< uint8_t > | sha1_digest (const uint8_t *data, size_t size) ROSE_DEPRECATED("use HasherSha1") |
ROSE_DLL_API std::vector< uint8_t > | sha1_digest (const std::vector< uint8_t > &data) ROSE_DEPRECATED("use HasherSha1") |
ROSE_DLL_API std::vector< uint8_t > | sha1_digest (const std::string &data) ROSE_DEPRECATED("use HasherSha1") |
ROSE_DLL_API uint64_t | fnv1a64_digest (const uint8_t *data, size_t size) ROSE_DEPRECATED("use HasherFnv") |
ROSE_DLL_API uint64_t | fnv1a64_digest (const std::vector< uint8_t > &data) ROSE_DEPRECATED("use HasherFnv") |
ROSE_DLL_API uint64_t | fnv1a64_digest (const std::string &data) ROSE_DEPRECATED("use HasherFnv") |
ROSE_DLL_API std::string | digest_to_string (const uint8_t *data, size_t size) ROSE_DEPRECATED("use Hasher") |
ROSE_DLL_API std::string | digest_to_string (const std::vector< uint8_t > &digest) ROSE_DEPRECATED("use Hasher") |
ROSE_DLL_API std::string | digest_to_string (const std::string &data) ROSE_DEPRECATED("use Hasher") |
template<class T , class U > | |
std::vector< std::pair< T, U > > | zip (const std::vector< T > &first, const std::vector< U > &second) |
Convert two vectors to a vector of pairs. More... | |
template<class T , class U > | |
std::pair< std::vector< T >, std::vector< U > > | unzip (const std::vector< std::pair< T, U > > &pairs) |
Convert a vector of pairs to a pair of vectors. More... | |
typedef HasherGcrypt<0> Rose::Combinatorics::HasherMd5 |
MD5 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 405 of file Combinatorics.h.
typedef HasherGcrypt<0> Rose::Combinatorics::HasherSha1 |
SHA1 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 406 of file Combinatorics.h.
typedef HasherGcrypt<0> Rose::Combinatorics::HasherSha256 |
SHA-256 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 407 of file Combinatorics.h.
typedef HasherGcrypt<0> Rose::Combinatorics::HasherSha384 |
SHA-384 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 408 of file Combinatorics.h.
typedef HasherGcrypt<0> Rose::Combinatorics::HasherSha512 |
SHA-512 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 409 of file Combinatorics.h.
typedef HasherGcrypt<0> Rose::Combinatorics::HasherCrc32 |
ISO 3309 hasher.
Throws exception if libgcrypt is not configured.
Definition at line 410 of file Combinatorics.h.
ROSE_DLL_API bool Rose::Combinatorics::flip_coin | ( | ) |
Simulate flipping a coin.
Randomly returns true or false with equal probability.
void Rose::Combinatorics::shuffle | ( | std::vector< T > & | vector, |
size_t | nitems = UNLIMITED , |
||
size_t | limit = UNLIMITED |
||
) |
Shuffle the values of a vector.
This algorithm randomly shuffles the items in the vector by swapping values at indexes zero through limit
with values at randomly selected indexes zero through nitems
. The defaults for nitems
and limit
are the size of the input vector
.
Definition at line 76 of file Combinatorics.h.
References Sawyer::fastRandomIndex().
std::vector<std::pair<T, U> > Rose::Combinatorics::zip | ( | const std::vector< T > & | first, |
const std::vector< U > & | second | ||
) |
Convert two vectors to a vector of pairs.
If the two input vectors are not the same length, then the length of the result is the length of the shorter input vector.
Definition at line 449 of file Combinatorics.h.
std::pair<std::vector<T>, std::vector<U> > Rose::Combinatorics::unzip | ( | const std::vector< std::pair< T, U > > & | pairs | ) |
Convert a vector of pairs to a pair of vectors.
Definition at line 461 of file Combinatorics.h.