Skip to content

Commit

Permalink
Add XOF::output<count>() to obtain an array
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Jun 21, 2024
1 parent c5f6a94 commit 3002915
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/xof/xof.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ class BOTAN_PUBLIC_API(3, 2) XOF {
return out;
}

/**
* @return the next @p count output bytes as a std::array<>.
*/
template <size_t count>
std::array<uint8_t, count> output() {
std::array<uint8_t, count> out;
generate_bytes(out);
return out;
}

/**
* Convenience overload to generate a std::vector<uint8_t>. Same as calling
* `XOF::output<std::vector<uint8_t>>()`.
Expand Down

0 comments on commit 3002915

Please sign in to comment.