| 188 | } |
| 189 | |
| 190 | static void TestChaCha20(const std::string &hexkey, uint64_t nonce, uint64_t seek, const std::string& hexout) |
| 191 | { |
| 192 | std::vector<unsigned char> key = ParseHex(hexkey); |
| 193 | ChaCha20 rng(key.data(), key.size()); |
| 194 | rng.SetIV(nonce); |
| 195 | rng.Seek(seek); |
| 196 | std::vector<unsigned char> out = ParseHex(hexout); |
| 197 | std::vector<unsigned char> outres; |
| 198 | outres.resize(out.size()); |
| 199 | rng.Output(outres.data(), outres.size()); |
| 200 | BOOST_CHECK(out == outres); |
| 201 | } |
| 202 | |
| 203 | static std::string LongTestString(void) { |
| 204 | std::string ret; |