tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 1 | // |
| 2 | // Created by Tyler on 10/6/20. |
| 3 | // |
| 4 | |
| 5 | #include "assignment-random.hpp" |
| 6 | #include <ndn-cxx/util/random.hpp> |
| 7 | |
| 8 | namespace ndn { |
| 9 | namespace ndncert { |
| 10 | |
tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 11 | NDNCERT_REGISTER_FUNCFACTORY(AssignmentRandom, "random"); |
| 12 | |
Zhiyi Zhang | 8683ec9 | 2020-10-07 18:18:35 -0700 | [diff] [blame] | 13 | AssignmentRandom::AssignmentRandom(const std::string& format) |
| 14 | : NameAssignmentFuncFactory("random", format) |
| 15 | {} |
tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 16 | |
Zhiyi Zhang | 8683ec9 | 2020-10-07 18:18:35 -0700 | [diff] [blame] | 17 | std::vector<PartialName> |
| 18 | AssignmentRandom::assignName(const std::vector<std::tuple<std::string, std::string>>& params) |
| 19 | { |
| 20 | std::vector<PartialName> resultList; |
| 21 | resultList.emplace_back(to_string(random::generateSecureWord64())); |
| 22 | return resultList; |
tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | } |
| 26 | } |